The Knicks looked like a team that was weary from a long trip for the most of the night. But they found their legs right about the time Carmelo Anthony nearly broke Thaddeus Young’s ankles.

Anthony’s crossover dribble on Young sent the Pacers’ forward to the Madison Square Garden floor in the third quarter. Anthony connected on the jumper, firing up the crowd, himself and the Knicks.

They were down 15 at the time, and got the spark they needed. The Knicks pulled away from Indiana and snapped a three-game losing skid with a 118-111 victory Tuesday night.

Anthony matched his season-high with 35 points to lead the Knicks (15-13). He had 26 in the second half. Anthony shot 13-for-25 overall, and was 7-for-11 on three-pointers.

“I think the energy that it was able to create within the building kind of gets you going,” Anthony said. “You start making some shots, start getting stops and you start playing differently when you have some momentum on your side.”

Anthony wasn’t the only one to give the Knicks a necessary lift in their first game back after a five-game Western road trip in which they dropped the last three.

advertisement | advertise on newsday

The return of Derrick Rose, who missed the previous two games with lower back tightness, was huge down the stretch. He scored 24 points, including in the fourth after the Knicks were down 99-91 with nine minutes to go.

Kristaps Porzingis added 10 of his 21 in the fourth, and hit the three-pointer that gave the Knicks the lead for good with 6:51 left. Joakim Noah, who has struggled to make an impact, finished with 11 points, 11 rebounds and two blocks.

This was the kind of production the Knicks envisioned when this team was assembled.

“We are going to need that in order to take that next step,” Anthony said. “We are going to need guys stepping up and making plays at different spurts in the game. I think that is why we put this team together because we know we have guys that can step up when they need to.”

Porzingis said the last few games and how this one started was a wake-up call because the Knicks can rely on their talent too much instead of locking in and playing together.

“We can still grow so much as a team,” Porzingis said. “We don’t want to lose sight just because we’re winning. We’ve got to see the big picture and keep growing as a team.

“These last three games kind of put our feet on the ground again and say, ‘OK, what do we have to do to win? What did we do before?’ I think with this game, it’s the first step back on the right track.”

Young and Myles Turner each scored 21 to lead Indiana (15-15).

The Knicks had two days off before playing Tuesday night while the Pacers were completing a back-to-back. Yet Indiana seemed to have the fresher legs until Anthony changed the direction of the game.

Anthony scored 11 points in the final 4:31 of the third to help the Knicks cut a 15-point deficit to 87-84 heading to the fourth.

advertisement | advertise on newsday

Then with Anthony on the bench, Rose and Porzingis carried the offense and erased a nine-point hole. The Knicks finally took the lead at 103-101 on a Porzingis’ three-pointer with 6:51 left.

“For KP and Derrick to step up and take over that game and lead us out there, along with what we did on the defensive end,” Anthony said, “we’re a dangerous team when we can get guys going like that and it’s coming from different areas.”

Shortly after Anthony returned, he took a feed from Noah and drilled a three that made it 108-102 with 4:31 to go.

After a Young three-pointer, Porzingis buried one from deep. Then Anthony drilled another three to put the Knicks up 114-105 with 2:57 remaining, and posed for a moment as the crowd roared.

“I was caught up in the moment,” Anthony said. “Sometimes ‘Stay Melo’ goes out the window, then I regroup myself.”