NEW YORK — Mathew Barzal responded less than 30 seconds after Philadelphia came back from three goals down in the third period to tie the score, and the New York Islanders got a big win over the playoff-chasing Flyers.

Barzal had two goals and an assist, scoring the tiebreaking goal with 6 1/2 minutes remaining, to lead the Islanders to a 5-4 win Tuesday night as Philadelphia squandered a chance to move closer to clinching a playoff spot.

"It was a great response to a tough situation," New York coach Doug Weight said. "It was nice to get that goal right away and we were able to hold it down (after that)."

John Tavares also scored twice and Anthony Beauvillier added a goal and two assists to help the Islanders get their third win in eight games, but just the fourth in their past 20 (4-12-4). Thomas Greiss stopped 27 shots.

Nolan Patrick had two goals and an assist, Claude Giroux added a goal and an assist, and Wayne Simmonds also scored for Philadelphia. Petr Mrazek finished with 32 saves while falling to 6-6-3 in 15 games since being acquired from Detroit.

The Flyers lead Florida by four points for the last playoff spot in the Eastern Conference after New Jersey won to jump one point ahead of Philadelphia for the first wild card. The Flyers and Devils each have two games remaining while the Panthers have three.

"Obviously it's in the back of our minds, but if we want to get that playoff spot we got to do better than that," Patrick said.

While the Flyers have beaten strong playoff-bound teams such as Winnipeg, Washington and Boston in recent weeks, they have lost to struggling teams such as Detroit, Dallas and the Islanders.

"Those teams are still good teams, not a lot of easy games anymore in this league," Giroux said. "We didn't earn that win tonight. We got make sure we come out strong next game."

The Islanders appeared to take control with a three-goal second period to take a 4-1 lead, but the Flyers — who were 5-0-3 in their previous eight — tied it with three goals in a nine-minute stretch of the third.

Patrick started the Flyers' rally in the third as he deflected Shayne Gostisbehere's point shot in at 4:07 to make it 4-2. Giroux's assist on the play extended his points streak to eight games.

Patrick then got Philadelphia to 4-3 as he knocked in a loose puck in front at 8:16 for his 13th and the rookie's first multi-goal game.

Giroux tied it with 6:56 left as he beat Greiss top-shelf on the glove side for his 30th.

"We let them back in it and gave them some life," Tavares said. "They started feeling a lot better about their game. ... They're playing for a lot and we're just trying to finish strong so we're just competing hard."

Barzal then regained the lead for New York just 28 seconds later as he was streaking to the net, got a pass from Beauvillier and beat Mrazek for his 22nd.

The Islanders went ahead with three goals while outshooting the Flyers 17-5 in the second.

Beauvillier gave New York a 2-1 lead as he skated across the slot and got his 20th at 3:43.

"It feels good to get to 20, but it's not the spot we want to be in right now," said Beauvillier, who scored for the fourth straight game and sixth time in his past seven.

Tavares put the Islanders up two with his second of the game with just under nine minutes left in the middle period, knocking the rebound of his initial shot over the falling Mrazek's glove for his 36th.

Barzal made it 4-1 from the right circle with 3:33 left in the period.

Tavares got the Islanders on the scoreboard 7:15 into the game, just 10 seconds into a tripping penalty on the Flyers' Sean Couturier.

Simmonds tied it with 53 seconds left in the opening period with his 24th.

NOTES: Tavares has six goals and 13 points in his past 15 games. He is two goals away from his career high of 38 set in 2014-15. ... Barzal's assist on Tavares' goal was his 60th, moving him two away from Sergei Makarov (62 for Calgary in 1989-90) for third by a rookie since the 1983-84 season. Joe Juneau leads that list with 70 for Boston in 1992-93, followed by Pittsburgh's Sidney Crosby with 63 in 2005-06. Barzal is also three away from tying Bryan Trottier for the Islanders' rookie mark set in 1975-76. ... Bailey, back after missing two games with an upper body injury, played in his 713th game, moving past Pat Flatley into sole possession for seventh place on the franchise list. ... The Islanders won three of four in the season series. ... Giroux has four goals and 10 assists during his scoring streak.

UP NEXT

Flyers: Host Carolina on Thursday night, and the New York Rangers on Saturday to close the regular season.

Islanders: Host the Rangers on Thursday night before closing season at Detroit on Saturday night.

___

Follow Vin Cherwoo at www.twitter.com/VinCherwooAP

___

More AP NHL: www.apnews.com/tag/NHLhockey