In a strange game with playoff implications for both teams, both the Rangers and Lightning ended up winners Tuesday night. The Rangers’ come-from-behind 3-2 victory at Madison Square Garden moved them within three points of the second-place Penguins in the Metropolitan Division as they battle for home-ice advantage in the playoffs. The Lightning clinched a postseason berth with Boston’s 2-1 shootout loss to Carolina.

The victory gives the Rangers 99 points, two more than the Islanders, who have a game in hand and visit the Garden on Thursday.

Derek Stepan had two goals and an assist and Henrik Lundqvist made 39 saves for the Rangers, who rallied from a two-goal deficit during a first period in which they were outshot 21-6.

“Our start was brutal,” Marc Staal said of the two-goal deficit just 6:07 into the game. “We were still on the plane from the night before.”

When Tanner Glass threw a blind side, high-shoulder hit, decking Vladimir Namestnikov in mid-ice at 15:57 of the first, receiving a five-minute interference penalty and a game misconduct, the special teams responded.

$relatedItem.embed_code.value

“We did a good job in the first in killing the five-minute major and built some momentum off it,” Stepan said. “Our group did a good job of responding After the first, we said, ‘we’ve got to be smarter, got to be smarter with our sticks.’ I think we took too many penalties.”

advertisement | advertise on newsday

Playing without injured captain Ryan McDonagh, the Rangers steadied thanks to the penalty-kill, which went 5-for-6. They scored three consecutive goals, starting with Stepan’s power-play laser from the left circle past goalie Andrei Vasilevskiy at 16:55 of the second. In the third, Stepan wound up and fired a blast from the right side to tie the score at 2:33, his 22nd of the year. Including his empty-netter in Columbus on Monday, he had scored the last three Rangers goals.

That streak didn’t last long.

Chris Kreider took a tape-to-tape pass from Marc Staal, skated in and put the puck under Vasilevskiy for the lead at 4:46. Stepan had the secondary assist on the goal. He has 21 points (eight goals and 13 assists in the last 16 games; Kreider has six goals and 11 points in the last 13 games.

“I think me and Chris have kind of found our grooves together,” Stepan said.

Lundqvist was in quite the groove as well in winning his 35th game. “He was our best player tonight,” Stepan said. “We come out of the first only down 2-0 because of him.”

The Lightning, without four injured regulars. played as if it wanted to clinch a playoff spot in the first period, outhustling the Rangers, and left the ice leading 2-0. Andrej Sustr scored his fourth of the season as Brady Skjei, in his fifth NHL game, was caught flat-footed and an open Sustr fired stickside to beat Lundqvist at 2:42.

With Dylan McIlrath, playing his first game since March 6, off for hooking, Brian Boyle jammed a shot through a scrambling Lundqvist at 6:07.

“I knew it was going to turn sooner or later,” Lundqvist said. “As long as it was a two-goal game, we were in it.”

And now the thoughts turn to the Islanders. “This place is going to be rocking,” Staal said, “and a good playoff- atmosphere test for us.”