The Islanders needed two points, and they got what they needed Friday night.

But when John Tavares limped off the ice with 3:14 remaining, it might have been the real end to their season, even as they kept their fading postseason hopes alive at Barclays Center.

It was an ugly 2-1 win in which the Islanders received 10 power plays from the sloppy Devils, who threw pucks over the glass and threw high sticks with equal abandon all night.

Anders Lee scored on the power play in the first period, Anthony Beauvillier scored at even strength in the second off a nifty feed from Josh Ho-Sang and Jaroslav Halak was sharp, making 26 saves as the Isles pulled within four points of the Bruins with five games to go.

That may all be moot, however. Tavares got tangled up with Devils defenseman Steve Santini behind the New Jersey net on the eighth Islanders power play and awkwardly tried to step through. Tavares appeared to catch his skate in a rut and immediately grabbed his left hamstring, going to the ice and needing help from his teammates to make it off the rink.

Doug Weight had no update after the game other than to say he’s hopeful — though also preparing to need another body for tomorrow’s game in Buffalo.

advertisement | advertise on newsday

“It’s a big blow any time you see your best player in distress,” Weight said after his team snapped a three-game losing streak and a five-game losing skid at home. “We’re going to need a guy to come up, step in and contribute, and we need the guys who were better tonight to keep pulling the rope.”

Cal Clutterbuck was disgusted about the poor ice surface that claimed his captain.

“You see a guy’s heel dig in like that, it doesn’t happen other places,” Clutterbuck said. “It’s something that doesn’t get addressed . . . It was a little worse [than it’s been]. It had been a little better the last few games, but not tonight.”

Tavares had an assist on Lee’s 29th goal and, as always, was around the net with all those power plays. The Isles had three separate five-on-threes, including one to finish the game in which they simply played keep-away to run out the clock and get the win they desperately needed.

After learning that Casey Cizikas and Travis Hamonic are done for the season after Thursday night’s ugly 6-3 loss in Philadelphia, the Islanders are scraping by. Ryan Strome and Nikolay Kulemin also are out for the final five regular-season games. If Tavares joins them, the Isles’ playoff hopes might not need any magic numbers or percentages to keep from being extinguished.

“It seems like they’re coming on us in this late wave. I’ve certainly been there,” said Lee, who missed last year’s playoff run after suffering a broken leg in the final week of the season. “We’ve got 20 guys who have to keep going and make the most of it.”