The pace was intense, the Barclays Center electric. Another Islanders-Rangers game did not disappoint.

And the Islanders did something that almost no team has been able to do to the Rangers in years. They wrestled a game away that the Rangers led after two periods.

Since February 2010, the Rangers had been 165-1-9 when leading after 40 minutes. But Brock Nelson and Nick Leddy scored 2:24 apart in the opening minutes of the third period and the Islanders held the fort from there Thursday night, earning a 3-1 win over their city rivals that put them two points ahead of the Rangers in the fight for second place in the Metropolitan Division.

The difference between second and third in the division means the difference between hosting a playoff series and starting it on the road — even if the “road” means a few subway stops to the south and east.

“The pace was probably the highest you see all season,” said John Tavares, whose quick pass around the back of the Rangers’ net found Leddy, who beat Henrik Lundqvist on the power play for the eventual winner. “It’s not easy to come from behind on any team in the third and we haven’t done it much ourselves this year.”

You have to go back to Nov. 29, 2013, for the last time the Rangers lost in regulation when leading after two periods.

The Rangers took a 1-0 lead on Marc Staal’s strong rush down the slot to deflect Kevin Hayes’ feed behind Jaroslav Halak with 45.4 seconds left in the second period.

The first 40 minutes at times were a blur of high-tempo skating and glorious scoring chances at both ends. The Rangers were very strong in the first 10 minutes of the game, with Rick Nash missing two chances in tight around Halak (34 saves), and Lundqvist (29 saves) strong on breakaways by Tavares and Cal Clutterbuck.

There was some nastiness, too, culminating in an aborted fight between Matt Martin and Dylan McIlrath in the closing seconds of the second period and a chicken-clucking gesture from Tanner Glass to Clutterbuck, reminiscent of Theo Fleury’s similar display towards Eric Cairns a dozen years ago at Nassau Coliseum.

“There is dislike, no question,” Clutterbuck said.

With the teams skating four- on-four to start the third period, the Isles used the open space well. Tavares was denied by Lundqvist in close and looked skyward, now without a goal in five games. But Nelson corralled a puck forced off Hayes’ stick by Adam Pelech and scored his 18th goal at 1:53 to tie it.

Nelson tried to poke at Lundqvist’s glove for a puck 90 seconds later and McIlrath, in for Dan Girardi, skated a long way to give Nelson a shove. That drew a roughing call, and the Islanders converted.

“In the end, they won the special teams, that was the difference,” Lundqvist said. “That’s going to be the case moving forward. A lot of tight games. Our penalty kill will have to come up big at key times.”

The rest of the third was played at a more deliberate pace by the Isles, who chipped pucks out of their end and used the bumpy, worn-down ice surface to their advantage. Kyle Okposo snapped one into an empty net with just under two seconds left.

“I’ve never been in a game like this one,” Pelech said. “It was a really high pace, the crowd was incredible. I’m just excited we won it.”