RJ Barrett banked in a 3-pointer at the buzzer to give the New York Knicks 108-105 comeback victory over the Boston Celtics on Thursday night.

Evan Fournier scored a career-high 41 points, and the Knicks overcame a 24-point, second-quarter deficit. The teams will finish the home-and-home set Saturday night in Boston.

Jayson Tatum scored 36 points for Boston. He tied it on a long step-back jumper with just over a second to play. The Knicks inbounded after a timeout, and Barrett banked in the long-distance shot for the victory.

"It was a tough shot, but every time I shoot I think it’s going in," Barrett said. "Honestly, I didn’t even see it because I fell. I didn’t see it go in, but just by everyone else’s reaction I could tell. So that was cool."

CLICK HERE FOR MORE SPORTS COVERAGE ON FOXNEWS.COM

New York Knicks guard RJ Barrett (9) makes the game-winning 3-point basket in front of Boston Celtics forward Jayson Tatum during an NBA basketball game Thursday, Jan. 6, 2022, in New York. The Knicks won 108-105.

New York Knicks guard RJ Barrett (9) makes the game-winning 3-point basket in front of Boston Celtics forward Jayson Tatum during an NBA basketball game Thursday, Jan. 6, 2022, in New York. The Knicks won 108-105. (AP Photo/Adam Hunger)

Julius Randle added 22 points for New York, Immanuel Quickley had 16, and Barrett 13. The Knicks didn't lead until there were just over two minutes left.

Dennis Schroder added 20 points for Boston, and Jaylen Brown had 16.

"It wasn’t about the last play again. It was everything leading up to it," Celtics coach Ime Udoka said. "We need some leadership. Somebody that can calm us down and not get rattled when everything starts to go a little south. I think it snowballs between our guys."

Robert Williams’ tip-in with 1:16 left in the first half gave the Celtics their final 24-point lead before the Knicks ended the quarter on an 8-0 run to pull to 63-47. Consecutive 3-pointers by Barrett and Fournier brought the Knicks within 10 to open the second half.

The Celtics re-established a 20-point lead, 81-61, on Schroder’s 3-point play with 5:33 left in the third quarter. Fournier followed with back-to-back 3s, and the Knicks pulled to 82-73 on Quickley’s 3-point play with 1:44 remaining.

Randle’s driving layup with 23 seconds left brought the Knicks to 84-77 heading into the final quarter. Boston built its lead back up to eight points, but Fournier’s long jumper tied it at 96-96 with 4:04 left.

The Knicks took their first lead, 99-98, on Fournier's 3 with 2:06 to go.

After Tatum’s three-point play and Mitchell Robinson’s dunk, Quickley’s floater gave the Knicks a 103-101 lead with 44 seconds remaining.

Schroder turned the ball over on Boston’s next possession, and Barrett made one of two free throws with 18 seconds left. Marcus Smart made two free throws with 15 seconds left, and Randle made one with 12 seconds remaining. Tatum then made his jumper before Barrett ended it.

"Resilience. It was special for our team," Randle said. "We kept battling. We obviously didn’t want to get in a hole, but we found a way to win the game."

TIP-INS:

Celtics: Knick coach Tom Thibodeau was an assistant for the Celtics from 2007-10. … Boston has lost three straight games at Madison Square Garden.

Knicks: Ryan Arcidiacono was signed to a 10-day contract prior to the game, but is sidelined with a sprained left ankle.

AND THE SEASON ISN’T HALFWAY OVER

Both teams have played 39 games this season, but no one has appeared in every one. Fournier and Alec Burks have each missed only one game for New York, while Smart has played in a team-leading 36 games for Boston. Thirteen Knicks have started at least one game, while the Celtics have had 11 starters.