Knicks forward Julius Randle, right, shoots at the basket past...

Knicks forward Julius Randle, right, shoots at the basket past Celtics center Robert Williams III during overtime in an NBA game Thursday in Boston. Credit: AP/Steven Senne

BOSTON —  To say that the Knicks needed to overachieve Thursday night against the NBA-leading Celtics seems an understatement. Before the game began, the TNT studio crew was mocking them, with Charles Barkley saying they haven’t been relevant since the Patrick Ewing days and Shaquille O’Neal bungling Julius Randle’s name.

Thirty-seven points later, Randle’s name should be clear to the crew now. And the Knicks, facing an imposing opponent for a second straight game, responded again. This time they survived an early 15-point deficit and a blown 13-point fourth-quarter lead for a 120-117 overtime win.

Paired with Tuesday’s victory over Cleveland, the Knicks have put together an unlikely two-game winning streak. They have won 17 of their last 27 games, albeit in streaky fashion.

The Knicks (27-23) are in seventh place in the Eastern Conference, three games behind the fourth-place Nets (29-19), whom they will play on Saturday.

With the Knicks leading 118-117, the Celtics’ Jaylen Brown missed two free throws with 7.6 seconds left and RJ Barrett made two with 5.7 seconds left. Jayson Tatum (35 points, 14 rebounds) then missed a long three-pointer and Jalen Brunson blocked Malcolm Brogdon’s three-pointer as the buzzer sounded.

“We can beat anybody. We can lose to anybody,” Randle said. “That’s the league. It’s super-talented. Very balanced league. So we can see how special we can be on a night-to-night basis if we come in with the right focus.”

The Knicks led 106-94 with 4:49 left in the fourth quarter, but the Celtics outscored them 21-4 in the next 6:29, taking a 115-110 lead in overtime. Randle and Barrett then hit three-pointers as the Knicks outscored Boston 10-2.

Brunson had 29 points and seven assists for the Knicks, who had fallen behind 22-7. Barrett had 19 points and Immanuel Quickley added 17. Brown had 22 for the Celtics (35-15).

The Knicks led 102-89 with just over seven minutes remaining in the fourth quarter, but when Brogdon hit a three-pointer with 1:57 left and  Tatum drove for a layup with 48.5 seconds remaining, the Celtics had tied it at 110.

Derrick White sank a corner three-pointer and Tatum hit two free throws with 3:20 left in overtime to put Boston ahead 115-110.

Randle finally got the Knicks on the board with a three-pointer with 2:45 left, but with three chances to take the lead, the Knicks missed each shot until Barrett finally connected on a corner three with 29.1 seconds left to give the Knicks a 116-115 lead.

With Tatum in the backcourt as a decoy out of a timeout, the Celtics inbounded to Brown, whose driving layup put Boston in front with 24.3 seconds left. Randle hit two free throws with 21.2 seconds left to push the Knicks in front 118-117, leaving the Celtics with an opportunity for a last shot.

Brown drew a foul with 7.6 seconds left but missed both free throws off the front rim. Barrett pulled down the rebound, was fouled and gave the Knicks a three-point lead.

“I think you just saw a team that’s fighting and scrapping for everything,” Barrett said. “Even just everything that we did tonight. Loose balls, everything, we fought hard the whole way and came in here and get a big win.”

“Just find a way to win,” Tom Thibodeau said. “The way the game started, they hit us pretty good to start the game. We fought back, we got back into it. Played really well. I thought our bench gave us another really good lift. And then some big plays down the stretch. I thought Quick gave us a big lift off the bench, Jules was Jules, Jalen was terrific. A good team win.”

“I think how we played last game, just getting that win, is how we’re going to have to play,” Barrett said before the game. “Especially during this stretch and just the rest of the season. We have a lot of big games coming up. When you’re trying to be the best, you have to beat the best. It’s going to be good for us to go against these teams and challenge ourselves and scratch and claw and come up with some wins.”

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