"We needed to get our confidence back, our confidence high going into that trip," said Hartnell, referring to a difficult three-game California journey that starts Thursday in Anaheim.
Steve Mason (33 saves), serenaded with chants of "Ma-son, "Ma-son" late in the game, collected his second shutout of the season, and the Flyers recorded their eighth straight home win over Detroit since 1997.
"This is just a small step in a bigger picture," Mason said.
Hartnell, who has played on the top line in the last two games, and linemate Claude Giroux (goal, two assists) each had three points. Hartnell has 21 points in his last 21 games; Giroux has 29 points in his last 22.
Earlier in the season, Hartnell was primarily on the first line with Giroux, but he was replaced by rookie Michael Raffl for about six weeks.
Yes, he likes being back on the No. 1 unit.
"You give him the puck, you're going to get it back," Hartnell said of the playmaking Giroux. "That second period, I could have had two or three goals. He tells me to always go to the net with my stick on the ice, and I thought we did a really good job tonight."
Hartnell called Giroux "one of the best passers in the game. He thinks the game, he's competitive. . . . When he goes, we go as a team."
The Flyers got goals from Hartnell and Adam Hall 2 minutes, 54 seconds apart midway through the second period to take a 3-0 lead. Hartnell's goal was his second of the night and 14th of the season.
Hartnell opened the scoring, redirecting Kimmo Timonen's point drive while the Flyers were on a power play with 6:18 to go in the first period.
Hartnell, who injured his foot while blocking a shot in Buffalo on Jan. 14, called it the Flyers' best period in three or four games. It was a first period in which the Flyers were defensively responsible, allowing just seven shots.
Mason, owner of a 4.56 goals-against average and an .851 save percentage in his previous six starts, rebounded and had his sharpest performance in several weeks. Mason made a glove save to rob Gustav Nyquist from the right circle while Detroit was on a four-on-three power play late in the first period.
"Tonight was a better effort than we've had," said Mason, who made 26 saves - some of them spectacular - over the last two periods. "There are still some things we need to work on, but it was a cleaner game than we've played recently."
Timonen injured his left foot while blocking a first-period shot. He played briefly in the second period before being replaced and did not return. The veteran defenseman wore a walking boot after the game.
Coach Craig Berube said the injury was not serious.
The Flyers got six hits and six blocked shots from Nick Grossmann while denying Mike Babcock his 400th coaching win with Detroit. They'll play in Anaheim Thursday. The Ducks entered Tuesday leading the NHL in points (83) and had a 21-1-2 home record.
They won't play their "B" team.