Detroit, meanwhile, moved a step closer to possibly missing out on the playoffs for the first time since 1990.
"We knew this was a key game, and we played like it," Hagelin said. "The Red Wings have been getting closer in the race, so it was big to get two points and keep them to none."
The Penguins boosted their chances of earning a 10th straight trip to the playoffs and hurt Detroit's quest to extend its postseason streak to 25.
Pittsburgh has won seven of eight, staying ahead of the New York Islanders for the third guaranteed spot from the Metropolitan Division.
The Penguins, already without injured forward Evgeni Malkin, lost two players to upper-body injuries during the game.
Forward Chris Kunitz scored early in the second and left the game late in the period after Pavel Datsyuk hit him without the puck and was called for interference. Pittsburgh defenseman Brian Dumoulin was checked into the boards in the first period by Justin Abdelkader, leaving him with blood on his face and he did not return.
Penguins coach Mike Sullivan ruled Dumoulin out of Sunday's game on the road against the New York Rangers, who are just ahead of Pittsburgh in the division.
"We'll re-evaluate (Kunitz) and he'll be a game-time decision," Sullivan said.
Pittsburgh's Marc-Andre Fleury made 21 saves, facing just four shots in the third period.
The Red Wings started the day a point behind Boston for third place in the Atlantic. Detroit is also in a closely contested race with the Islanders and Philadelphia to be the two wild-card teams that earn spots when the season ends in two weeks.
"We have to look forward," Detroit goaltender Petr Mrazek said. "We have seven games left."
The Red Wings pulled Mrazek, for the second time this season against Pittsburgh, late in the second after he gave up four goals on 15 shots in the period.
"We have to play better obviously," he said. "They have a good skilled team up front."
Detroit's Jimmy Howard didn't fare much better, giving up three goals.
The Penguins scored a season-high in goals and Detroit gave up seven for the first time this season.
Andreas Athanasiou put Detroit up midway through the first period, but a fired-up crowd at Joe Louis Arena didn't have much to be happy about the rest of the afternoon. The fans who stuck around until the end booed as the Red Wings skated off the ice.
Kunitz tied the game 20 seconds into the second, then Kris Letang, Hagelin and Kessel followed with goals in the period to put the Penguins ahead 4-1.
Detroit pulled within two goals 5-plus minutes in the third, then Eric Fehr, Hagelin and Nick Bonino scored to restore the lopsided score in the final period. Bonino also had four assists.
"It was frustrating," Red Wings coach Jeff Blashill said. "It was embarrassing."
Datsyuk made his 300th career assist and joined Gordie Howe, Alex Delvecchio and Steve Yzerman as the players in franchise history with at least 600 goals and 300 points. ... The Penguins swept the season series 3-0, scoring 13 goals against Mrazek and getting him benched twice. ... Detroit, which had won three of four games, hosts Buffalo on Monday night. ... Penguins Ben Lovejoy played after missing 16 straight games with an upper-body injury.