Ovechkin, who has five goals in his past three games, leads the Capitals with 31 goals in 75 games this season to increase his NHL record-setting career total to 928.
Tom Wilson scored twice, Jakob Chychrun had a goal and two assists, and Ryan Leonard had a goal and an assist for the Capitals (38-28-9), who have won three straight games and are 5-1-1 in their past seven. Pierre-Luc Dubois had four assists, and Logan Thompson made 20 saves.
Travis Sanheim and Christian Dvorak each had a goal and an assist, Travis Konecny had two assists, and Dan Vladar made 12 saves for the Flyers (37-25-12), who had won three straight and had their eight game road winning streak ended.
Wilson, who was playing in his 900th career game, gave the Capitals a 1-0 lead at 14:59 of the first period. Dubois entered the zone and dropped the puck back to Wilson, who scored on a snap shot from the high slot.
Ovechkin made it 2-0 at 18:35. Matt Roy drove to the net and, after drawing Vladar to the left post, he centered the puck and it bounced around the slot before Ovechkin tipped it home.
Sanheim pulled the Flyers within 2-1 when he scored with a snap shot from the high slot 39 seconds into the second period. The goal was initially waved off due to goaltender interference by Dvorak, but the Flyers challenged and the call was overturned after a video review.
Carl Grundstrom tied the score 2-2 at 4:36, scoring in front after a backhand pass from Trevor Zegras in the corner.
Chychrun gave the Capitals a 3-2 lead with a power-play goal at 6:58, scoring on a one-timer from the left dot off a backhand pass across the point from Leonard.
Leonard made it 4-2 at 17:37 when he received a pass in the right circle from Dubois and beat Vladar with a glove side snap shot on the power play.
Dvorak pulled the Flyers within 4-3 when he scored from the left post off a pass from Konecny behind the net.
Ovechkin made it 5-3 at 3:47, receiving a backhand pass from Connor McMichael and putting a diving snap shot past Vladar from the bottom of the right circle.
Denver Barkey cut the Capitals' lead to 5-4 when his wrist shot from the point deflected in off Washington defenseman Martin Fehervary at 7:52, but Wilson scored into an empty net at 18:56 for the 6-4 final.