PHILADELPHIA -- Kevin Hayes scored two goals for the Philadelphia Flyers in his first game against his former team, a 5-1 win against the New York Rangers at Wells Fargo Center on Monday.
Hayes played his first five NHL seasons with the Rangers before being traded to the Winnipeg Jets on Feb. 25.
"It's nice to get goals, but the main goal was to get two points tonight," said Hayes, who signed a seven-year contract with the Flyers after they acquired him in a trade from the Jets on June 3. "I thought our power play didn't really help us in the beginning, they took the momentum there, and then the team came out in the third and we've been good in the third all year."
[WATCH: All Rangers vs. Flyers highlights]
Defenseman Travis Sanheim scored two goals and had an assist for Philadelphia (21-11-5), which won its fourth straight game heading into the Christmas break. Carter Hart made 34 saves.
Jesper Fast scored for New York (17-15-4), which was coming off a 5-1 win against the Anaheim Ducks at Madison Square Garden on Sunday. Henrik Lundqvist made 25 saves for the Rangers, who have lost four of their past five games (1-3-1).
"I liked a lot of things we did tonight," New York coach David Quinn said. "I liked our third until we shot ourselves in the foot. It's 2-1, we're doing good things ... then we give them the third goal and we got demoralized, and reality set in."
Video: NYR@PHI: Sanheim sneaks wrister through for late goal
Hayes gave the Flyers a 2-1 lead at 7:31 of third period when he beat Lundqvist to the far side off the rush from the left face-off circle.
"It kind of rolled up my stick, and I was just hoping he was cheating a little bit and I went far side," Hayes said. "I think it hit the post and went in. Little bit of a lucky shot."
Sanheim scored his second of the game to make it 3-1 at 15:49, and Hayes made it 4-1 with his second at 17:15.
Nicolas Aube-Kubel made it 5-1 for the Flyers with his first NHL goal, on the power play with 58 seconds remaining.
Video: NYR@PHI: Hayes roofs tic-tac-toe goal in transition
It was Sanheim's first goal, with two seconds remaining in the second period, that turned the game. He took a pass from Justin Braun and scored from above the right hash marks to tie the game 1-1.
"No doubt that goal at the end of the second period, momentum-wise, energy-wise, gave us a boost," Philadelphia coach Alain Vigneault said. "I can't speak for them, but it probably hurt them a little bit."
The Rangers outshot the Flyers 14-7 in the second and led 1-0 on Fast's shorthanded goal at 6:44.
"We should be going in 1-0, and then we give up a goal with [two seconds] left in the second period, then give up five unanswered goals," forward Chris Kreider said.
Video: NYR@PHI: Fast nets one-timer from slot for shorty
New York went 0-for-4 on the power play, including a 5-on-3 for 1:04 in the first period, and is 0-for-18 in the past five games.
"You get a 5-on-3 ... you have to score, and we didn't," Quinn said. "We had a few chances, but every time we get it, we slow it down and try to make a pretty play, and we just ... we're going to keep working on it because our power play has really been a problem lately."
Philadelphia went 1-for-6 on the power play.
They said it
"It's a big game, it is disappointing to lose. We were right there. Just the way it ended too, as a goalie it is tough. They took whatever they wanted the last five minutes there in front. It was disappointing." -- Rangers goalie Henrik Lundqvist
"I don't know if I'm squeezing it at all. I'm getting chances, things aren't going my way at times. Just got to stick with it, and if you're generating, you'll eventually break through. Nice to get a pair tonight." -- Flyers defenseman Travis Sanheim on scoring two goals after going 15 games without one
Need to know
Rangers forward Artemi Panarin's point streak ended at seven games. (seven goals, four assists). ... It was Vigneault's first game coaching against the Rangers since being fired by New York on April 7, 2018. ... Flyers defenseman Ivan Provorov, who was a game-time decision because of an illness, led Philadelphia in ice time at 23:20.
Rangers: Host the Carolina Hurricanes on Friday (7 p.m. ET; MSG, FS-CR, NHL.TV)
Flyers: At the San Jose Sharks on Saturday (10:30 p.m. ET; NBCSCA, NBCSP+, NHL.TV)
Video: Sanheim, Hayes net two goals, Flyers top Rangers