New York Knicks' Kristaps Porzingis of Latvia dunks as Minnesota...

New York Knicks' Kristaps Porzingis of Latvia dunks as Minnesota Timberwolves' Gorgui Dieng of Senegal looks on during the first quarter of an NBA basketball game, Wednesday, Nov. 30, 2016, in Minneapolis. Credit: AP / Jim Mone

MINNEAPOLIS — Kristaps Porzingis finished a distant second to Karl-Anthony Towns in last season’s Rookie of the Year voting. Porzingis also finished a distant second to Towns in points in Wednesday night’s Knicks-Timberwolves game at the Target Center.

But while Towns put a charge into the mostly empty arena with a 47-point performance, Porzingis “settled” for 29 and a victory as the Knicks beat Minnesota, 106-104.

Towns and Porzingis dueled for most of the night, but it was Carmelo Anthony who knocked down the winning jumper with 2.3 seconds left after the Knicks, who led by 17 midway through the fourth, allowed the Timberwolves to tie the game with less than a minute to go.

Anthony, who finished with 14 points and shot 5-for-16, ended the game by stealing an errant inbounds pass as the Timberwolves never got off a final shot.

It was a nice time for Anthony to step up.

“My teammates believed in me,” Anthony said. “My coach believed in my drawing that play up. Either we were going to win or we were going to overtime.”

The Knicks improved to 9-9 overall and 2-6 on the road.

Porzingis shot 11-for-20 and added eight rebounds. Derrick Rose scored just 11, but Brandon Jennings had 14 off the bench.

Towns, in a career-best scoring night, shot 15-for-22 and added 18 rebounds. Andrew Wiggins had 19 for Minnesota (5-13). The Knicks will host the Timberwolves on Friday in the rematch.

“I think it was a good show for everybody,” Porzingis said. “What’s important is we got the win at the end. They came back. We didn’t do the best job at the end of the game. We let them back in the game, but I’m happy that we got the win and that’s all that matters.”

The Knicks led for most of the game, but the Timberwolves tied it at 102 with 49.8 seconds left on a three-pointer by Zach Lavine.

Porzingis put the Knicks back on top with a dunk off a Justin Holiday miss with 36.4 to go. Towns tied it again at 104 on a pair of free throws with 24.2 left for his final points.

Then Anthony took over. Better late than never.

“He’s done it for years and years,” coach Jeff Hornacek said. “That’s the guy we want to go to. We felt that they were going to try to double him and then someone else was going to be open to shoot the ball. They spaced the floor well enough that it was hard for them to go and double him and then Melo just made a great shot.”

Towns scored Minnesota’s first seven points and passed his career high of 35 by the third quarter. Knicks spirits had to rise when they saw Cole Aldrich, the onetime Knick, replace Towns at the start of the second quarter after Towns torched them for 22 in the first. The Knicks outscored Minnesota 30-18 in the second to take a 58-49 lead into halftime and they expanded it to as much as 17 with 7:42 to go in the fourth.

The Knicks were without starting center Joakim Noah, who was out with a sprained left ankle. They also lost starting shooting guard Courtney Lee to a sprained ankle in the first quarter. Lee did not return and was unsure if he would be able to play on Friday.

In Monday’s 112-103 loss to Oklahoma City, the Knicks got only 19 points from their bench for the entire game. That was not a problem on Wednesday, when the Knicks bench outscored Minnesota’s, 43-5.

Mindaugus Kuzminskas had 14 points and the Knicks got some big minutes from Marshall Plumlee, who had four points and five rebounds in 19:29.