Zach Hyman had a goal and an assist, and Matt Savoie scored in his third straight game for the Oilers (37-28-9), who won three games in a row for just the second time this season. Evan Bouchard had two assists, and Connor Ingram made 27 saves.
Edmonton pulled within three points of Anaheim, which has a game in hand, for first place in the Pacific Division.
Cutter Gauthier and Beckett Sennecke scored, and John Carlson had two assists for the Ducks (41-28-4), who had four straight wins during a six-game point streak (5-0-1). Lukas Dostal made 30 saves.
McDavid put Edmonton ahead 1-0 at 7:36 of the second period after corralling a bouncing puck off a slap shot from the point by Evan Bouchard that went wide. Carlson sent a clearing attempt off McDavid’s skates at the side of the net before both McDavid and Max Jones took a backhand stab at the puck, with Jones touching it first and McDavid tapping past Dostal’s’ blocker midair.
Edmonton outshot Anaheim 11-3 in the second period.
Roslovic extended it to 2-0 with his 20th goal of the season at 4:59 of the third period. He took a pass from the slot by Hyman on an odd-man rush and scored five-hole as Dostal came across the crease.
Savoie pushed it to 3-0 at 6:10 after taking a cross-crease pass from Vasily Podkolzin and stuffing it glove side past Dostal from in tight.
Sennecke cut it to 3-1 at 6:53, tipping a wrist shot from the point by Carlson through Ingram’s legs.
Gauthier made it 3-2 at 9:41, taking a pass from behind the net by Jeffrey Viel, following another point shot from Carlson, and snapping it into open space stick side behind Ingram.
Hyman scored into an empty net on a pass from McDavid with 17 seconds remaining for the 4-2 final.