NBA

Knicks outlast Pistons for second straight win

It’s as good a time as any for Carmelo Anthony and the Knicks to face the Heat.

Anthony saved the Knicks from a humiliating collapse Tuesday at the Garden. He scored 34 points, keyed a 15-0 third-quarter spree, secured a big offensive rebound and then made two game-sealing free throws with 2.9 seconds left.

This performance won’t be nearly good enough to beat the Heat when they come to visit on Thursday, but the Knicks survived after nearly blowing a 17-point lead, hanging on for a 89-85 victory over the Pistons.

“Early on in the season, we were losing those type of games but tonight we won,’’ said point guard Raymond Felton, who struggled down the stretch but whose return from a six-game absence was a triumphant one.

“Sometimes it becomes contagious, you win a few close games and you remember how to win them,’’ coach Mike Woodson said.

The Knicks came back from their successful Texas Triangle journey by outlasting the Pistons, but it was not an effort to crow about.

“We won the game, that’s all that matters,’’ Anthony said.

It was the Knicks’ third victory in four games and stirred up some buzz for Thursday’s first showdown against the Heat at the Garden since Miami became two-time defending NBA champions.

“Is that who we play next?,’’ Anthony said jokingly. “We got to face them some way, somehow. We can’t run from them. We’re getting better each day. They’re playing well. We got to lace our sneakers like they do come Thursday.’’

The Knicks led 73-58 entering the final quarter before folding and allowing Detroit to cut it to 86-85, with Felton coughing up the ball twice in the final minute.

Anthony has ignited the Knicks since returning from a sprained ankle at the beginning of the Texas trip, and Tuesday, he made 13 of 24 shots, bagged 6 of 7 3-pointers and notched four steals.

After one of his late 3s, Anthony glared at the Pistons bench where new assistant coach Rasheed Wallace, a Knick last season, heckled him.

“We had a staring contest,’’ Anthony said. “Rasheed was talking to me. That’s my guy. I learned a lot from ’Sheed. It was just fun, going back and forth with him.’’

Felton, coming back from a groin strain, racked up 12 points with six assists and had to play 30 minutes because backup Beno Udrih had a sore knee.

“In the fourth quarter, your legs start getting a little tired, certain shots are not going to fall,’’ Felton said. “I’m just glad we showed the grit.’’

With center Tyson Chandler missing the contest with an upper respiratory infection, Andrea Bargnani also stepped up, scoring 13 points and grabbing 11 rebounds.

The Knicks (12-22) closed to 1½ games behind the eighth-seeded Pistons for the East’s final playoff berth. It was a good day for the Knicks’ playoff hopes. The sixth-seeded Bulls — in tank mode with Derrick Rose gone for the season — dumped Luol Deng to the Cavaliers for Andrew Bynum, whom they then waived.

“We are starting to have a little more fun out there and trusting each other more than we had,’’ Anthony said. “When it comes down in situations in game, the last few games, we are all on the same page.’’

With the Knicks clinging to a a one-point lead and 27 seconds left, Anthony committed a charging foul after going to a badly executed isolation play and getting triple-teamed on a forced drive.

But the defense held up. The Pistons, trailing 86-85, had a chance to win it. But Josh Smith, hounded by Anthony, threw up a horrendous airball and Felton grabbed the rebound. He was fouled, but missed the second free throw.

Anthony tipped the rebound up to Kenyon Martin, who batted it back to Melo. Anthony raced out to the perimeter to kill some clock and was fouled. He made both free throws with 2.9 seconds left for a four-point lead to seal it.

It was a smart play by Anthony, taking extra seconds off the clock, and unusual for the Knicks, who have been accused of bad clock management this season.

“We got to know the situation out there, time, score,’’ Anthony said. “You have to learn from situations like that.’’