Gustav Nyquist and the Detroit Red Wings pulled out a victory over the New Jersey Devils that seemingly slipped away with a terrible start.

Nyquist scored the only goal in the shootout, and the Red Wings rallied for a 5-4 win on Friday night.

Detroit had trailed 4-1 before surging to victory.

"We all said that things weren't going good, and we had to forget about it and rebound," Nyquist said.

That they did, as Riley Sheahan, Xavier Ouellet, Justin Abdelkader and Drew Miller scored for the Red Wings in regulation. Backup goalie Petr Mrazek, in his second start of the season, made 21 saves through overtime.

"It was a big win for us," Mrazek said. "After the overtime, I was pretty excited, because it was my first NHL shootout. It was great, because I had to stay positive after a tough first period.

"I couldn't think much about it. But we all played hard and got it done. I'm really happy about this one."

Mike Cammalleri scored two power-play goals for New Jersey. Jaromir Jagr got his 709th goal, moving into sole possession of sixth place on the NHL career list — one ahead of Mike Gartner. Peter Harrold also scored for the Devils.

New Jersey lost more than a game. Travis Zajac and Adam Henrique, the team's two top centers, missed the third period. Their status for Saturday's game on Long Island is "uncertain," Devils coach Pete DeBoer said.

Zajac has a lower-body injury. Henrique has an upper-body injury.

Nyquist beat Cory Schneider in the third round of the shootout, and Mrazek sealed the win with a pad stop on Michael Ryder.

Mrazek was the fourth backup the struggling Devils faced in five games. New Jersey has only three wins in 12 games.

Jagr had two points, giving him 1,770 and moving him within one of Marcel Dionne, who is fifth on the career list.

The Red Wings have won three in a row and five of six. Niklas Kronwell and Henrik Zetterberg each chipped in two assists.

The Red Wings scored a third unanswered goal when Miller netted his first of the season at 10:07 of the third period to make it 4-4.

Kronwell drove hard to the net, only to have his shot blocked. Miller swatted the loose puck into the left side of the net.

"When you're not scoring, you don't get chances like that," Miller said. "So I was lucky to find the rebound, and just put it in there. It feels great. It was a huge goal for the team and a huge goal for me."

Ryder had a solid chance to pull it out for Devils in the closing minutes, but couldn't deposit the backhander.

Jagr, Cammalleri and Harrold staked the Devils to a 3-1 lead after one period.

With the teams skating 4-on-4, Jagr got the Devils rolling at 2:18.

Detroit countered with a power-play goal at 3:50 when Sheahan deflected Kronwall's blast from the left point by Schneider.

Cammalleri put New Jersey back in front at 2-1, snapping in a shot from the left circle for a power-play tally at 13:52.

Harrold, taking a feed that Jagr threaded through traffic, scored from the right circle dot at 15:18.

It was the first goal in 49 games for the Devils defenseman, playing in his second game this season following a recall from the minors on Nov. 17.

Cammalleri struck again on the power play, 28 seconds into the second period, for the Devils' third unanswered goal.

A seemingly secure advantage slipped away as the period progressed.

Ouellet, left alone in the slot, got his first NHL goal at 1:55 to cut the deficit to two. That energized the Red Wings as they outshot the Devils 17-6 in the period.

The Devils blew a golden opportunity to reverse the momentum with a 5-on-3 power play for 1:56. New Jersey managed only one shot in that span.

"We had a chance to extend the lead and didn't do anything with it," DeBoer said. "That was a key moment in the game. Then, we took a lot of penalties and let them back into it. I expected us to have a little bit more of a killer instinct, but we didn't have it."

Abdelkader, wide open in the slot, swatted a pass out from Henrik Zetterberg for a power-play goal at 12:52 to trim the Devils' lead to 4-3.

And the tide had turned in Detroit's favor.

"How many leads can we continue to lose, good healthy leads? There are no excuses for us," Cammalleri said. "I hope we're not ready to dwell over this. We can't overthink things. We have to pull up our socks, man up and get ready to play a big one against the Islanders."

NOTES: After nine days on the road, where they went 1-2-1, the Devils were home for only one game. ... Detroit will host Vancouver on Sunday to begin a four-game homestand. ... D Marek Zidlicky dressed for the Devils despite a right foot injury sustained in New Jersey's 2-0 loss in Vancouver on Tuesday. ... The Devils have one win in the last 21 games decided in a shootout. ... The Red Wings are 1-3 in shootouts this season.