Nick Cousins and Sam Gagner scored in a shootout after Brayden Schenn tied the game in regulation late in the third period to lift the Philadelphia Flyers to a 2-1 victory over the Washington Capitals on Wednesday night.

The win propelled the Flyers out of a tie with idle Detroit for the final playoff spot in the Eastern Conference.

Alex Ovechkin scored in regulation for Washington (54-16-6), which was seeking a franchise record for victories after already clinching home-ice advantage throughout the playoffs with the league's best regular-season record.

Steve Mason made 29 saves in regulation and overtime for the Flyers and stopped T.J. Oshie and Evgeny Kuznetsov in the tiebreaker.

Cousins, Philadelphia's first shooter, beat Braden Holtby through the five-hole. After an excellent glove save by Mason on Kuznetsov, Gagner shot past Holtby to send the Flyers into a wild celebration in front of their own goal.

The game pitted teams that could match up in the first round of the playoffs. Washington claimed the second Presidents' Trophy in club history with Monday's 4-1 win over Columbus.

Meanwhile, Philadelphia is fighting just to get into the playoffs. The Flyers began play tied with Detroit for the eighth and final playoff spot in the Eastern Conference with 87 points. Philadelphia, though, has six games remaining while Detroit has five. The Flyers and Red Wings will meet next Wednesday in Detroit.

Ovechkin gave Washington a 1-0 lead with a power-play goal after receiving a pass from Kuznetsov 1 ½ minutes into the third period. Ovechkin fired a wrist shot from the left circle past Mason's glove side. It was Ovechkin's league-leading 44th goal, and Kuznetsov's team-high 54th assist.

The Flyers tied it at 1 with a power-play goal of their own with 5:28 remaining when Schenn deflected Claude Giroux's slap shot high over Holtby for his 25th tally of the season.

The Capitals had the best chance in a penalty-filled, entertaining overtime. Nicklas Backstrom's slap shot on a power play with 3:54 left in the extra session caromed off the post.

Holtby remained on 46 wins, which is two shy of Martin Brodeur's league record set in 2006-07. He made 33 saves in regulation and overtime.

Mason started his seventh straight contest and 12th in the last 13 games. Mason has been pressed into extra duty because Flyers backup goalie Michal Neuvirth (lower body) is out for the rest of the regular season. Current backup Anthony Stolarz has zero NHL experience. The Flyers brought in veteran Ray Emery for a tryout on Wednesday.

It's likely the Flyers will need to use a backup goalie at some point the rest of the way, as they finish the regular season with six games in nine days. All six games are back-to-back situations. Of the six games, three are against teams ahead of the Flyers in the standings.

Both goalies were strong through two periods of scoreless hockey.

Mason made 18 saves while Holtby stopped 23 shots.

Each team had good chances in the second period. Ovechkin unleashed a wrist shot off the right post four minutes into the period. Holtby made a good save on Ryan White's one-time attempt from the slot 1 ½ minutes later, and he denied Cousins and Michael Raffl from close range later in the period.

The Capitals played their regulars as they hope to stay sharp heading into the playoffs. The other time they finished with the league's best regular-season record was the 2009-10 season when they were eliminated in the first round of the playoffs.

NOTES: Eight teams have won the Stanley Cup after finishing with the league's best record, the last of which was Chicago in 2013. ... Philadelphia next plays on Saturday at home against Ottawa.