Matt Martin of the Islanders and Pavel Buchnevich of the...

Matt Martin of the Islanders and Pavel Buchnevich of the Rangers collide during the second period at Madison Square Garden on Thursday. Credit: Jim McIsaac

The Islanders know that any playoff-worthy team finds a way to make just the play they need at just the right time, in just the right place. With maybe a little emphasis on the latter.

As rewarding as it has been for them to be part of the revival of Nassau Coliseum, it also is sweet for them whenever they can win in another special place, which they did on Thursday night. An opportunistic win over the Rangers at Madison Square Garden can make two points seem larger than the standings will show.

“The history, the rivalry between us, between our fan bases. A lot certainly goes into it. We look forward to these ones,” said Josh Bailey, who scored with 1:26 remaining — on the Islanders’ only shot of the third period — to earn a 4-3 victory that had its share of entertaining moments.

It was not a perfect game by the Islanders. In fact, both sides would say that the Rangers played better in the final period. But the visitors did what they had to do when they had to do it (and where).

Winning goalie Robin Lehner said, “You can feel it out there. A good game, some emotions. It’s always fun. It’s a great building. You hear a bunch of our fans here, too. It’s loud, it’s fun. We’re two close teams and we want to win.”

Both sides invested a lot in this one despite their different circumstances. The Islanders are all-in on 2018-19 and are in the first wild-card spot. The Rangers are committed to their rebuild, which almost surely will mean trading at least one solid veteran rather than trying to get reinforcements for a postseason push.

Here’s the contrast: The Rangers are fresh off a western trip in which they went 0-3, were outscored 15-3 but were encouraged by a 4-2 loss to the Vegas Golden Knights. Recently, the Islanders had a western trip in which they went 3-1, outscored the opposition 12-7 and were upset by a 4-2 loss to the Vegas Golden Knights.

You can’t argue with either approach. The Islanders are seeking the credibility they’ve been lacking; the Rangers are seeking the fresh blood they’ve been lacking. On Thursday night, the Islanders were hungry for points in the playoff race and the Rangers were desperate for a confidence boost for their development process in front of their fans.

“It’s a tough one,” said Henrik Lundqvist, who has lost 11 of his past 12 decisions against the Islanders (1-9-2) in the past five seasons. “We played really well. We put ourselves in a really good spot to win the game. There were things that happened that we just have to clean up to win games. It’s a tough one, but it is what it is.”

It was good to see some zip and bite on the ice, much more so than in the rivals’ first meeting of the season, which Islanders coach Barry Trotz had said was “pretty tame.” This time there was jawing, a wrestling match between Matt Martin and Cody McLeod that officially was classified a fight, and scoring that went back and forth. Good show.

They will meet again Saturday afternoon at Barclays Center, where the Rangers never have won.

Cal Clutterbuck, whose pass led to Bailey’s goal, said, “None of that really matters at this point. It’s all about us getting back to what has made us successful the last month-and-a-half. We got two points today and we don’t want to give them back on Saturday.”

We’ll take it. We’ll take all we can get from the two teams that are vowing to get better in their own separate ways. We’ll see what the future holds. The Islanders had the final hold on Thursday night, and on the Garden.