Knicks guard RJ Barrett shoots around Indiana Pacers center Myles Turner during...

Knicks guard RJ Barrett shoots around Indiana Pacers center Myles Turner during the first half of an NBA game in Indianapolis on Sunday. Credit: AP/AJ Mast

INDIANAPOLIS — Not every game was going to be a thing of beauty.

Sometimes in a winning streak, there has to be a grind-it- out, happy-to-survive game, and on Sunday at Gainbridge Fieldhouse, the Knicks found themselves in a battle for survival. And as has been the case often through this stretch, it was their defense that saved them.

The Knicks overcame a late deficit and earned a 109-106 win over the Indiana Pacers, extending their winning streak to seven games — the longest current streak in the NBA — and improving to 17-13. They have won six straight road games, their longest streak since 2012-13.

Jalen Brunson led the Knicks with 30 points and provided the late lift he has in so many games this season. Julius Randle had 25 points — including four clutch free throws in the final seconds — and RJ Barrett added 24.

“This is a tough one,” Randle said. “We were on the road for almost a week, playing a team that we’re fighting with for playoff position, and to hang on to a win on the road is tough.”

“Right now,” Pacers coach Rick Carlisle said, “New York is as good as any team in the NBA.”

Quentin Grimes hit a three-pointer — his only field goal of the game — with 3:03 left to pull the Knicks within 99-98, but the Pacers went ahead 104-98 on what looked like a back-breaking play, with Tyrese Halliburton firing a pass to a wide-open Aaron Nesmith for an uncontested dunk with 1:56 remaining.

Brunson hit a three-pointer to cut the lead in half and then — with the Pacers swinging the ball around, hunting for an open shooter — he jumped into the passing lane, swiping Andrew Nembhard’s pass and going coast-to-coast for a layup to get the Knicks within one with 1:21 left.

“They were showing on Julius,” Brunson said. “I created a little space, was able to knock it down. Then I was just playing the passing lanes. I knew we were kind of scrambling. The right play for them was the extra pass, extra pass. I just kind of jumped it, was able to go down and score.

“We’re growing. We’re getting better every day. Obviously, we don’t want to be in rotations, but these things happen. We just have to cover for each other. We saw one thing happen and everyone is kind of on the string. I just read it and reacted, got it going.”

“It was huge,” Randle said. “It was huge. He made really a lot of really big plays down the stretch, so that’s what JB does.”

“The point guard, it’s a leadership position,” coach Tom Thibodeau said. “His job is to manage and control the game, and so I think it’s what he does very well. And I think Jules helps with that as well, and RJ does, too. But Jalen’s the point guard, so he’s the guy in charge of all of it.”

Randle stole the ball from Nesmith and converted a pair of free throws with 45.6 seconds left to give the Knicks a 105-104 lead.

The Knicks stole the ball a third straight time, this one by Grimes, but he lost the ball as they tried to move it upcourt. Randle dived on the floor and nearly recovered the loose ball, but it was bobbled out of bounds, giving Indiana the ball with 18.8 seconds remaining.

Haliburton misfired on a long three-pointer with Randle switched on to him and Randle then took over. He hit two free throws for a 107-104 lead with 7.4 seconds left and two more for a 109-106 lead with 4.5 seconds to play.

Halliburton put up a shot just inside of midcourt at the buzzer that bounced off the rim and allowed the Knicks to survive.

“We’re playing some really good basketball right now, sticking together on both ends,” Barrett said. “Everybody’s contributing. It’s fun to watch. It’s amazing to see. We just got to continue that as long as we can.”

SUBSCRIBE

Unlimited Digital AccessOnly 25¢for 6 months

ACT NOWSALE ENDS SOON | CANCEL ANYTIME