Knicks forward Kristaps Porzingis reacts thinking he was fouled on...

Knicks forward Kristaps Porzingis reacts thinking he was fouled on a second half shot while playing the Pistons at Little Caesars Arena on Dec. 22, 2017. Credit: Getty Images / Gregory Shamus

DETROIT — The Knicks nearly did it.

They nearly beat their road blues. They nearly won an incredibly tough game and almost pulled off what would have been a huge confidence-boosting win as they head into a brutal stretch.

Instead, they blew a late four-point lead to ruin a bounce-back game by Kristaps Porzingis and lost to the Pistons, 104-101, at Little Caesars Arena.

“We just didn’t execute the plays,” said Porzingis, who had 29 points and nine rebounds. “We rushed some things. We just didn’t execute. We didn’t run the play the right way. There’s nothing. We have to run the plays the right way, everybody, including myself. That’s it. Simple.”

When the situation called for calm and precision in the final minute, the Knicks (17-15) rushed and made mistakes.

The trouble began with the score tied at 101 as Ron Baker drove and turned over the ball with 33 seconds left. Reggie Jackson was fouled and made a free throw to give the Pistons a 102-101 lead.

Courtney Lee then drove and had his layup blocked by Reggie Bullock. Stanley Johnson’s two free throws made it a three-point game.

The Knicks got the ball back with 14.5 seconds left for one final chance. Lee attempted to make a move but was shut off. He forced a pass to Porzingis, who barely had time to grab it and throw up a desperation 35-footer that missed the rim.

“Yeah, it’s definitely frustrating,” Lee said. “We’re up at the end of the game and a couple of mistakes where, I mean, those last final possessions, we messed up two plays out there and rushed one play, so it was definitely self-inflicted. It was definitely frustrating.”

The Knicks fell to 2-10 on the road. One good thing to come out of the game was Porzingis’ rebound from his 0-for-11 shooting night on Thursday. He shot 12-for-28.

“We just need to know how to finish the games,” said Enes Kanter, who had 22 points and 16 rebounds. “Especially the fourth quarters are really important for us. If we’re talking about playoffs, we need to figure it out. It’s too important, man.

“If a team doesn’t know how to win on the road, then even if we make the playoffs, we’re not gonna go that far.”

The Pistons (18-14) were led by Long Island’s Tobias Harris, who had 24 points and five assists.

The Knicks never led in the first half and trailed by as many as 13 points. A 12-0 run in the third quarter that included six points by Kanter made it close for the rest of the game.

On a lot of levels, it was expected to be a tough game for the Knicks. Detroit is a playoff-caliber team and has won four of its last five games. It also was the second night of back-to-back games for the Knicks, who flew to Detroit late Thursday night after defeating the Celtics at Madison Square Garden.

The Knicks are 0-4 on the road in the second night of back-to-backs.

The Knicks now return home for a Christmas Day game against Philadelphia, and after that, things get ridiculous.

The Knicks, who are 15-5 at home and have been the beneficiary of an easy early schedule, will play 16 of their next 20 on the road.

Said Lee: “We have to learn from this. We have to learn and get better.”

Newsday LogoYour Island. Your Community. Your News.Digital AccessOnly 25¢for 5 months