Knicks forward Kristaps Porzingis drives against Pelicans forward Anthony Davis...

Knicks forward Kristaps Porzingis drives against Pelicans forward Anthony Davis during a game in New Orleans, Saturday, Dec. 30, 2017. Credit: AP / Jonathan Bachman

NEW ORLEANS — The Knicks haven’t had much reason to celebrate lately, especially on the road. But when Anthony Davis’ three-pointer was off the mark in the final seconds, the Knicks had their own end-of-year party on the court.

They showed fight and resiliency at the end of this three-game road trip and closed out 2017 with a 105-103 victory over the Pelicans on Saturday night.

The Knicks celebrated on the court and the locker room was loud after the game, and for good reason. They nearly dropped the ball before the ball officially dropped on 2017, squandering a 16-point third-quarter lead. But they erased an eight-point deficit with 2:57 left to end their losing streak at four and win for the third time in 15 road games.

“Really, we shouldn’t be celebrating like we did,” Kristaps Porzingis said. “The postman doesn’t celebrate when he delivers mail. But it was good to get a win, finally, on the road.”

Porzingis finished with 30 points and saved his best for last. He scored seven consecutive points — an emphatic dunk with Davis and DeMarcus Cousins closing in, a three-pointer and a jumper — during a 12-2 run after the Knicks fell behind 99-91.

The Knicks (18-18) also got big contributions from Jarrett Jack and Joakim Noah. Yes, Joakim Noah.

Jack scored nine points in the fourth quarter, including the winning free throws with 9.1 seconds left. He was responsible for all but two of the Knicks’ last 14 points, scoring five and dishing out three assists.

Jeff Hornacek turned to Noah to help guard DeMarcus Cousins with the Knicks’ other big men in foul trouble. In only his fifth game, Noah was on the court for the last 13 minutes, had four points and four rebounds and played his usual hard-nosed defense. “I was happy for Jo that he went out there and played the way he did,” Hornacek said. “That was a big lift.

Said Noah, “It felt really good. It’s been a while.

Davis had 31 points, nine rebounds and five blocked shots for the Pelicans (18-18). Cousins had 29 points and 19 rebounds.

The Knicks have dropped games like this one. They led by 15 in Chicago on Wednesday night but lost when they couldn’t execute down the stretch, scoring one point in the last 4:23.

This appeared to be heading toward a similar disappointing ending after Cousins’ three-pointer and layup gave the Pelicans a 99-91 lead. But Jack fed Noah for a dunk, then got a steal and canned a three-pointer, and you could see the Knicks believing they would win. They scored on their final six possessions.

“We’re down eight with a couple minutes to go,” Hornacek said. “It’s an easy time for guys to quit and think this game is over. But they didn’t.”

Said Porzingis, “At the end, we executed the right way and made the right pass, the right shot and didn’t force things.”

Porzingis picked up his fourth foul midway through the third quarter. The Knicks were up 11 at the time but were outscored 22-8 before he returned.

Porzingis gave the Knicks a 103-101 lead with a jumper off an assist from Noah. The Knicks needed a stop, but Porzingis was called for a questionable foul on Cousins with 27.4 seconds left. His two free throws tied it.

Out of a timeout, the play was going to be a pick-and-roll between Jack and Porzingis, but Jack ended up getting into the paint and was hit by Jrue Holiday as he threw up a floater. Jack, who missed a free throw with a chance to tie the score in the waning seconds in Chicago, swished both of these.

“KP hit a few shots down the stretch. I kind of knew that his man wasn’t going to leave him,” Jack said. “So I knew I’d probably have a nice little lane to the basket. I was able to get downhill. Jrue Holiday fouled me, hit me across the arm a little bit and the side of my head a little bit. Went to the line and knocked them down.”

The Pelicans had one last shot and Davis got a good look in front of Hornacek. He and the rest of the Knicks were relieved that the shot was short. “Our guys stayed poised,” Jack said. “We didn’t fold. We bent a little bit but we didn’t break. Allowed ourselves an opportunity at the end of the game and guys came through.”

DON'T MISS THIS LIMITED-TIME OFFER1 5 months for only $1Save on Unlimited Digital Access