Instead of finding a way to lose, as so often happened during the Islanders’ five-game skid, they created a way to win last night.

Rather than fold after falling behind 2-0 before getting a shot on net, they dug deep. Instead of letting what they felt was a bad call pull the Rangers even, the Islanders responded.

The result was arguably their best win of the season, a 4-3 shootout victory at the Garden over the rival Rangers, the Islanders’ first win at MSG in nine tries.

“This is a great feeling,” John Tavares said. “This is what we want to do. We want to win hockey games. We want to be a competitive team and we want to put ourselves in the best position to make the playoffs.”

The chips were stacked against the struggling Islanders. Mired in a deep slump, they were getting out-shot 10-0. Nothing was going right. But by the end of the night, they were talking about this hard-to-believe victory snapping them out of their recent funk.

From Evgeni Nabokov’s brilliance in net with 36 saves to the stunning three-goal outburst in the span of 6:56 in the second period to the smart, gritty and physical play up and down the roster, it was a victory to cherish for the Isles.

“You could see it in guys’ eyes,” Nabokov said. “They’re just fired up, they start pulling for each other.”

The victory was equal parts thrilling and unexpected, considering the two teams were headed in opposite directions entering the contest. The biggest shock was the start of the comeback, from the fourth line of Casey Cizikas, Colin McDonald and Matt Martin.

The trio was a factor all game. It was McDonald delivering one big hit and fighting off another before depositing a Cizikas feed from in front, just 29 seconds into the second period, his third career goal.

“It’s about work ethic and desperation and they had it, and I think the guys fed off of that,” Islanders coach Jack Capuano said.