The Flyers will go into their holiday break feeling good about themselves.

They won their fourth straight game Monday, getting two goals from Kevin Hayes and Travis Sanheim and strong goaltending from Carter Hart as they defeated the New York Rangers, 5-1, at the roaring Wells Fells Fargo Center.

With 12 minutes, 29 seconds left in regulation, Hayes scored on a left-circle blast in his first game against his former team, snapping a 1-all tie. The goal was scored after Hart made a big save on Artemi Panarin down the other end.

Sanheim, who had the second two-goal game of his career, secured the win by scoring with 4:11 to go. The defenseman took a feed from Sean Couturier, who had been stopped by Henrik Lindqvist but hustled after his own rebound.

Hayes added his second of the night with 2:45 remaining, and Nic Aube-Kubel scored the first goal of his NHL career with 58 seconds to go, giving the Flyers four third-period goals -- and three in the final 4:11.

“We had a lot of shots; the problem was just getting bodies in front,” said rookie Joel Farabee, who set up Hayes’ go-ahead goal. “Once we did that, the goals started to come.”

Hayes, who had his first two-goal performance as a Flyer, said there was a “little bit” of extra motivation to play against his former team, “but we’re [almost] 40 games in. This is the team I concentrate on.”

While Hayes downplayed facing the Blueshirts, his teammates and his coach sensed the game meant a lot to him.

“We all knew he was going to be pretty fired up and ready to go,” Sanheim said.

Coach Alain Vigneault said Hayes “has been wound up about this game for a while.”

Hart finished with 34 saves as the Flyers raised their home record to 13-2-4. Hart made several key stops when the game was close in the third period, including a glove save on Pavel Buchnevich’s drive from the high slot with 15:58 left. He also got a break when Mika Zibanejad fired a shot off the post with 7:30 to go.

Hart, 21, outdueled Rangers legend Henrik Lundqvist, 37, a likely future Hall of Famer who suffered his fifth straight loss to the Flyers, a team he has faced 60 times in his stellar career. He is 35-18-5 against them with two no-decisions.

The Flyers go into the holiday break with a 21-11-5 record, the 15th time in franchise history they have reached the 21-win mark before Christmas and the first time since 2011-12. They moved past Pittsburgh and Carolina and into third place in the Metro.

The Flyers were outplayed in the second period, but left the ice in a 1-1 tie thanks to Sanheim’s goal with 1.7 seconds left in the session.

“Sanny’s goal was huge and gave us a lot of momentum heading into the third,” Farabee said.

“Lundqvist was playing pretty good and making some big stops, and it was nice to break through,” Sanheim said. “I knew there wasn’t much time left, but I didn’t know there was only one second left. I guess it’s a good thing I shot it.”

With Travis Konecny distracting Lundqvist in front, Sanheim scored on a wrist shot from the high slot for his first goal in 16 games, putting the puck through the goalie’s legs..

“He was patient with it and got off a good shot,” Konecny said.

The Flyers’ power play struggled and even allowed the game’s first goal.

Ivan Provorov, who was battling the flu, lost the puck in the Flyers’ offensive end and it led to a two-on-one for the Rangers. Hart stopped Brady Skjei, but Skjei gathered his own rebound and fed Jesper Fast, who beat Hart with a one-timer from the slot to give the Rangers a 1-0 lead with 13:16 left in the second period.

It was the Rangers’ eighth shorthanded goal, tops in the NHL.

In a scoreless first period, the Flyers killed a two-man advantage that lasted 1:04. During that power play, Sean Couturier saved a goal by blocking Buchnevich’s point-blank chance with Hart out of position and the Rangers right winger staring at an open net.

Vigneault faced the Rangers for the first time since they fired him after the 2017-18 season.

Earlier in the day, he called coaching in New York a “special time in my life, and this is going to be a special game.”

Hayes, Sanheim, and Hart made it extra special.