Joakim Noah #13 of the New York Knicks reacts after...

Joakim Noah #13 of the New York Knicks reacts after a basket in the first half against the Chicago Bulls at Madison Square Garden on Thursday, Jan. 12, 2017 in New York City. Credit: Jim McIsaac

The Knicks found themselves in a very familiar position, leading by double digits down the stretch. No lead has been safe lately, but this was one they wouldn’t give up.

Only 24 hours earlier, they let a 10-point lead with 2:29 left disappear in a last-second loss to the 76ers. But despite being without Kristaps Porzingis because of a sore left Achilles, the Knicks played until the final buzzer and snapped a three-game losing streak with a 104-89 victory over the Bulls on Thursday night at the Garden.

Carmelo Anthony had 23 points, nine rebounds and six assists for the Knicks (18-22), who had lost nine of their previous 10 games and 12 of their previous 15. Derrick Rose added 17 against his former team. “We were desperate to win,” Rose said.

“It was one of those games we had to win,” Kyle O’Quinn said.

Jeff Hornacek was interested in seeing how the Knicks would respond after their gut-wrenching loss in Philadelphia on T.J. McConnell’s turnaround baseline jumper over Porzingis and Anthony as time expired.

It was the Knicks’ second defeat at the buzzer in an eight-day stretch. They led both by double figures in the second half. But the Philly loss was the worst one in a season filled with bad losses.

Hornacek said the Knicks could “drop their heads and lose by 40” or “fight and battle, scratch and claw.” They did the latter Thursday night. “It should say something about our team,” he said before the game.

The Knicks showed that they can be resilient and overcome a demoralizing loss quickly, but it’s only one game. They need to string some wins together to prove they’re moving in a positive direction.

“The guys didn’t hang their heads after last night’s loss,” Hornacek said. “They played with the same fire for the game and they battled all night. Just the fight we showed was great to see.”

Mindaugas Kuzminskas scored 19 points off the bench. A fired-up Joakim Noah, who is playing with a sore right shoulder, had 12 points and 15 rebounds against his old team. O’Quinn finished with 12 points and 11 rebounds.

It was the Knicks’ first win on the second night of a back-to-back. They had been 0-7. “Yesterday was tough,” Noah said. “We had to bounce back. We hadn’t been great on back-to-backs. To come in with a win like that, especially against the Bulls, it feels great.”

Dwyane Wade scored 22 to lead the Bulls, who were without star forward Jimmy Butler and reserve Nikola Mirotic.

The Knicks came out like a team that wanted to wash the stench of the Philadelphia loss off them. They scored the game’s first eight points and maintained the lead until a 13-2 Bulls run in the second quarter put them in a 39-36 hole.

From there, Anthony and Rose dominated the rest of the second quarter. Anthony had nine points and an assist and Rose scored seven points, including a three-point play with 4.8 seconds left, as the Knicks took the lead for good at 54-51.

Anthony continued his strong play in the third quarter. He had four points and had three assists during a 14-4 run that gave the Knicks a 74-61 lead. O’Quinn scored six consecutive points in that time.

The Knicks’ biggest lead in the fourth quarter against the 76ers was 13. Against the Bulls, they went ahead 86-71 when Kuzminskas drove and dunked with 8:46 left. But they weren’t in the clear.

The Bulls got within 94-84 with 2:57 left, but Anthony fed Kuzminskas for a reverse layup. After former Knick Jerian Grant drilled a three-pointer to make it a nine-point game, Anthony hit a three with 1:48 left for a 99-87 lead.

“Losing [expletive],’’ Noah said. “We look back at some of those losses we took, they were really a heartbreak overall. I’m just happy we bounced back like that, we showed some resiliency, and we just got to keep going, keep getting better.’’

Newsday LogoSUBSCRIBEUnlimited Digital AccessOnly 25¢for 5 months
ACT NOWSALE ENDS SOON | CANCEL ANYTIME