The Islanders can thank Tyler Bertuzzi for this win.

Bertuzzi’s unnecessary slash to Cal Clutterbuck’s knee late in the third period resulted in a five-minute major and match penalty. The Islanders, who were down by three and looked done for the night, erupted for their best power play of the season, scoring four times within the five minutes on the way to a wild and miraculous 7-6 overtime win against the Red Wings on Friday night at Barclays Center.

“It was a pretty incredible display of a power play,” head coach Doug Weight said. “They just went at it, shot the puck and were hungry around the nets. They made some great plays by some great players.”

Weight credited the Red Wings for suffocating the Islanders for much of the game, especially by preventing them from skating and playing freely. But once that third-period power play rolled around, fortunes turned in the Islanders’ favor.

Josh Bailey scored at 18:11 in the third to give the Islanders their fifth score of the frame and the 6-5 lead. But Jaroslav Halak, who relieved Thomas Greiss earlier in the period, coughed up the equalizer to Mike Green with just 29 seconds left in regulation.

In overtime, Brock Nelson completed his second career hat trick for the winner. All three of Nelson’s unlikely goals came in the third period or overtime.

“[Mathew Barzal] made a hell of a pass,” Nelson said of his game-winning goal. “I was trying to drive hard to the net. … I didn’t have to [yell for the puck]. He has some pretty good vision.”

Despite the wildly upbeat ending, the Islanders’ play left a lot to be desired.

After a lifeless first period, they appeared quickly buried. Three Detroit goals in the opening frame led to a woeful intermission exit for the Islanders, who were drowned in boos as they left the ice.

The Islanders once again let up an alarming number of shots (39) and had trouble mustering their own. They registered just three shots in the second period, resulting in one goal.

Jordan Eberle notched his 19th of the season at 9:36 of the second to give the Islanders a little momentum before Johnny Boychuk, who returned to the lineup after missing 18 games, dropped the gloves with Justin Abdelkader to wake up the Islanders.

Nelson brought the Islanders within one early in the third period, but Greiss let in two goals two minutes apart and was pulled — skating off to deafening boos — in favor of Halak.

Luckily for Greiss, Clutterbuck’s knack for annoying opponents got him off the hook.

“That was a huge play by Clutterbuck,” said Barzal, who finished with a game-high five points. “He made a good play to get someone pissed off at him. It was a whole team effort tonight.”

Anders Lee and Nick Leddy also scored during the five-minute power play to electrify the crowd and, for at least one night, mask the negatives on display for much of the game.

“I feel like this can capsize a lot of that [negativity],” Weight said of the win, which coupled with a Blue Jackets loss moved the Islanders into the final Eastern Conference wild-card slot. “I’ve seen it a lot of times. … We have to recognize what a big win it was.”