The Flyers, coming off a disastrous road trip, returned Wednesday to a building where they haven’t lost in more than a month.

They kept that streak alive.

Getting a shorthanded goal from Kevin Hayes and strong goaltending over the last 40 minutes from Carter Hart, the Flyers ended a four-game losing streak, defeating the NHL’s best team, Washington, 3-2, at the Wells Fargo Center.

“We’ve struggled lately, but we know we have a good team,” center Sean Couturier said. “Tonight we proved we can win against the top teams.”

“A real character win," coach Alain Vigneault said.

The Flyers are 14-2-4 at home and 9-13-2 on the road. After ending the four-game skid, Vigneault didn’t want to talk about his team’s huge home-road disparity. He just wanted to enjoy the victory.

“You know at this time right now, I’m going home tonight, and I’m going to have a martini and enjoy the win and I’m going to get back to that,” he said. "Our next game is at home, so focus on the homestand right now.“

The Flyers’ defense survived some tense moments in the third period.

With a little more than 13 minutes left in regulation, defenseman Ivan Prorovov made a key play to break up a three-on-one Capitals rush.

About 3 1/2 minutes later, Washington’s Tom Wilson went in alone, but Hart (26 saves) stopped his backhander with his left pad, keeping the Flyers ahead, 3-2.

The Flyers also killed a Washington power play that started with 5:50 left. That made the Flyers 5-for-5 on the penalty kill.

“We needed these two points; we had a lot of energy for tonight,” said defenseman Robert Hagg, who had a goal, three hits, and three blocked shot.

Washington controlled most of the second period, but Hart, who overcame a shaky first period, was flawless in the stanza as he stopped all 11 shots.

Despite managing just three second-period shots, the Flyers took a 3-2 lead on Hayes’ shorthanded goal, the team’s third of the season.

Scott Laughton forced John Carlson into a turnover near the Capitals’ offensive blue line, Hayes picked up the loose puck and scored on a forehand-backhand move with 2:01 remaining in the second.

"Scotty had a great forecheck, and when they eventually broke it out, they were in a little bit of distress there,” Hayes said after his 13th goal of the season and his second shorthanded tally. “I think Carlson kicked the puck and it came to me.”

The Flyers continued to give up opening-period goals at an alarming rate, but at least they used Hagg’s tally late in the stanza to go into the first intermission tied at 2-2.

Outscored by 15-5 in the opening period during their recent six-game road trip, the Flyers took a 1-0 lead. For the second straight game, Travis Konecny opened the scoring early in the first period.

Couturier took the puck off Nick Jensen near the boards and fed an all-alone Konecny, who took over the team lead with his 14th goal, whipping a high shot past Braden Holtby with 16:36 left in the first.

“Coots made a great play to get me the puck, and I just tried to make a quick shot to the far side,” Konecny said. “Honestly, I didn’t pick a spot. I just kind of released it.”

The lead lasted less than four minutes.

Travis Sanheim, pressured by Alex Ovechkin, gave the puck away behind the net to Tom Wilson, who fed Nicklas Backstrom. Backstrom’s shot from the high slot dribbled off Hart and into the net.

Flyers winger Tyler Pitlick (No. 18) celebrates Robert Hagg's second-period goal Wednesday.
ELIZABETH ROBERTSON / Staff Photographer
Flyers winger Tyler Pitlick (No. 18) celebrates Robert Hagg's second-period goal Wednesday.

With 6:26 remaining in the first and a delayed penalty called on the Flyers, Jakub Vrana scored on a drive from the high slot after a bad rebound allowed by Hart had kept the sequence going. Sanheim appeared to screen Hart on the goal, which put the Caps ahead, 2-1.

But after an uneventful power play, Hagg made it 2-2 as his point blast deflected off the Capitals’ T.J. Oshie and past Holtby, who made several high-quality first-period saves to cover up for his team’s defensive miscues.

“It’s about time,” said Hagg after scoring his first goal in 32 games, dating back to March 23, 2019.

The Flyers were coming off a season-high six-game, 12-day road trip in which they went 1-4-1 and were outscored, 28-16.

“It was a long one,” Konecny said. “Sometimes, you just need to get home. It’s a learning curve for the whole team, going through a road trip like that, but it’s nice to be back in our home building.”

The Flyers have a plus-36 goal differential at the Wells Fargo Center, and a minus-31 goal differential on the road.

Hart’s home-road disparity is even more eye-opening. He is now 12-1-2 at home, 2-9-1 on the road. At home, he began Wednesday with a 1.49 goals-against average and .947 save percentage, which towered above his road performance (4.01 GAA, .850 save percentage).

Vigneault said Hart wants the two goals he allowed back, “but in the second and third periods he came up big and in big moments.”

Then the coach went home and enjoyed a martini.