NBA

A rally painful win for Knicks

CLEVELAND — With Carmelo Anthony injuring his right knee in the second quarter, Mike Woodson was forced into playing Amar’e Stoudemire past his 30-minute, team-imposed cap in a desperate move to pull out a win in Cleveland.

It worked, as the Knicks rallied from a 22-point second-quarter deficit to beat the Cavaliers, 102-97, behind Stoudemire’s 22 points in a season-high 31:55 minutes.

Stoudemire was 10-of-15 from the field and scored the dagger basket, spinning down the baseline, having his shot blocked, regaining it and laying it in to put the Knicks up 99-95 with 42 seconds left. Stoudemire beat his chest running back downcourt as the memory of being benched late against Miami on Sunday must have felt far away.

Anthony left the game midway through the second quarter with an injured right knee after tripping over himself and didn’t return, with the club down 21 points. The extent of the injury was not known, but the Knicks said he would not go for an MRI exam, so it didn’t appear to be too serious. The Knicks said he’d be reevaluated tomorrow in Detroit.

The Knicks surged in his absence. Jason Kidd sank what looked like the clincher — a 3-pointer with 1:38 left to put the Knicks up 97-91. But the Cavs rallied and Kidd needed to come up big again. He came up with a key offensive rebound with six seconds left after Stoudemire missed a jumper on an inbounds pass. Kidd was fouled and made 1 of 2 free throws to put the Knicks up 100-97.

Kyrie Irving, off an inbounds, dribbled to the 3-point line and launched a shot that Tyson Chandler blocked to seal the win.

Stoudemire was benched for the final 7:52 in the Miami loss and Woodson was pilloried for it. Before the game, Woodson said it was perplexing for him to figure out Stoudemire’s role under the 30-minute cap imposed by the medical staff but planned to increase his workload. Did he ever?

J.R. Smith responded from his awful outing vs. Miami to finish with 18 points. He hit the clinching free throw with 0.6 seconds left that put the Knicks up 4. Steve Novak added 15 points.

The Knicks got off to one of their worst defensive starts in recent memory, allowing Cleveland to hit 22 of its first 27 shots, allowing journeyman Marrese Speights to go 7-of-7 in the first quarter for 15 points and 10-for-10 by halftime. The Cavaliers were shooting 81.5 percent midway through the second quarter as the Knicks suffered from a Miami hangover in the worst way.

The Cavs built a 52-30 lead midway through the second quarter after a C.J. Miles 3-point shot.

It was around that time Anthony, 1-of-5 from the field and seemingly out of it, tripped over his feet and injured himself. Kidd threw him a pass at midcourt and Anthony fell, with no defender near him, landing hard with 6:42 left in the half.

He got up slowly and walked directly to the locker room without looking at the bench — looking part embarrassed, part injured. He is not undergoing an MRI which appears to be good news.

Stoudemire checked into the game as the Knicks went on a 10-0 run.

After the Miami loss Sunday, Anthony mentioned he not only had treatment on his hyperextended left arm but also his knee, which had been giving him problems.

The Knicks closed to within 61-49 at halftime.

And the Melo-less Knicks came out on fire to start the second half, going on a 12-1 run to start. Stoudemire started the second half at power forward.

Felton fed Stoudemire for a powerful reverse dunk to get the Knicks within 61-59 late in the third quarter. They got to 61-60 but no closer and trailed 74-70 after three quarters.

The Knicks finally grabbed the lead for the first time since early in the first quarter when Novak drilled a 3-pointer from up top, putting them up 79-78 with 9:23 left.

marc.berman@nypost.com