NEWARK, N.J. -- Timo Meier and Dawson Mercer each scored two goals for the New Jersey Devils in a 5-2 win against the Pittsburgh Penguins at Prudential Center on Tuesday.

"Everyone loves winning, so when you win a hockey game like that, it's always a lot of smiles," Mercer said. "We just want to make sure we stick to that mentality. We want to try to do that for the remainder and want to make sure that we get as many as we can."

Jack Hughes, Luke Hughes, Ondrej Palat, Jesper Bratt and Tomas Nosek each had two assists, and Jake Allen made 36 saves for the Devils (33-32-4), who had lost two in a row and seven of their previous nine.

"I thought it was probably the most complete game that I've seen since I've been here," said Allen, who was acquired in a trade with the Montreal Canadiens on March 8. "I thought it was impressive to come out in the third period, sort of kill their will right away, and then after that, play a very mature game."

PIT@NJD: Mercer goes five-hole to give Devils lead in 1st period

Marcus Pettersson and Bryan Rust scored, and Tristan Jarry made 33 saves for the Penguins (30-29-9), who are 2-5-1 in their past eight games.

Pittsburgh is 0-6-1 against New Jersey dating to Feb. 24, 2022.

"Whatever the highest level of desperation is, that's where we're at," Penguins captain Sidney Crosby said. "I think that's the situation we're in and there's nothing else to do other than play with some urgency and desperation and try to get a game at a time."

Mercer gave the Devils a 1-0 lead at 5:35 of the first period, getting a pass at the blue line and skating down the middle before Pittsburgh defenseman Ryan Graves inadvertently swept the puck off his stick and into his own net.

"Yeah (he swept it in), but we'll keep that on the low ... it still counts," Mercer said. "I just wanted to try to take it to the net as quick as I could."

Allen, who was making back-to-back starts for the first time since Oct. 21-23 with the Canadiens, made 12 saves in the first, including diving to his right to deny an uncovered Crosby at 18:38.

"I saw him ... he walked out in front of the net and was patient, waiting me out," Allen said. "It's desperation, but at the same time there's a lot of luck involved there and sometimes you're lucky, sometimes you're not. It was an important first game of this three-game homestand."

Pettersson tied it 1-1 at 7:16 of the second period on a slap shot from the point.

“The start was disappointing,” Penguins coach Mike Sullivan said. “They come out with a lot of pace, we didn't match the urgency. I thought we grabbed a hold of it after the first, but the first bit of the first period, they certainly had momentum early on.”

Meier put New Jersey back in front 2-1 at 14:20 with a power-play goal on a waist-high tip-in from the slot.

Alexander Holtz pushed it to 3-1 on a rebound at 8:58 of the third period.

Mercer then scored 16 seconds later to make it 4-1 on a wrist shot from outside the right post at 9:14.

The Palat-Nosek-Mercer line accounted for six points (two goals, four assists).

"They were a very responsible line," Devils interim coach Travis Green said. "As a coach, you want to feel like you can put a line out in certain scenarios, especially against a team that has three or four good lines. I felt like those three players not only can defend and understand the game defensively, but they can also create offense, too."

Meier extended it to 5-1 at 16:53 with his second power-play goal, on the rebound of Bratt’s shot, giving him 11 goals in his past 13 games after he scored 10 in his first 43.

"He looks like a different player," Green said of Meier. "He's confident, he's skating, he's physical. He's doing everything that we want a top player to do. He's paying attention to details and getting awarded for it."

Rust scored on a backhand at 17:14 for the 5-2 final.

NOTES: Crosby had an assist to give him 69 points (33 goals, 36 assists), one shy of becoming the first active player, and ninth player in NHL history, to have at least 14 70-point seasons. ... Meier has 21 goals this season and is the third Switzerland-born player to have at least six 20-goal seasons (Nino Niederreiter, seven; Kevin Fiala, six).