Cutter Gauthier had a goal and an assist, and Lukas Dostal made 25 saves for the Ducks, who won their first Stanley Cup Playoff series since eliminating the Oilers in seven games in the 2017 Western Conference Second Round.
The Ducks, who are the No. 3 seed from the Pacific Division, will face either the Vegas Golden Knights or Utah Mammoth in the second round. Vegas leads that series 3-2 with Game 6 on Friday.
Connor Murphy and Vasily Podkolzin scored, and Connor Ingram made 26 saves for the Oilers, who reached the Stanley Cup Final the previous two seasons.
The Ducks scored first for the first time in the series when John Carlson took a slap shot from above the right face-off circle that went off the stick of Oilers defenseman Jake Walman, bounced off the ice and glanced off Ryan Poehling before trickling across the goal line for a 1-0 lead at 9:56 of the first period.
Carlsson led a 4-on-3 rush through the neutral zone, got the puck back and then fed Kreider for a one-timer from the right circle and a 2-0 lead at 13:43.
Dostal couldn't control a rebound and Josh Samanski passed the puck through the crease to Murphy, who flipped it into the top of the net with a backhand to cut it to 2-1 at 15:14.
Anaheim, which came into the game 7-for-14 on the power play in the series, scored on its first man-advantage when Gauthier's one-timer from the right circle went off the stick blade of Oilers defenseman Darnell Nurse and fluttered over Ingram's right shoulder for a 3-1 lead at 16:50.
Dostal, who was removed in the first period of Game 5 after giving up three goals on nine shots in the 4-1 loss, stopped Zach Hyman on a partial breakaway at 4:36 of the second period, and Hyman put the puck in the net at 18:28, but it was quickly determined he used a kicking motion.
Terry then finished off a 2-on-1 rush with Carlsson to extend the lead to 4-1 with 47 seconds left in the second period.
Edmonton cut it to 4-2 at 1:13 of the third period when a shot by Kasperi Kapanen hit the backside of Podkolzin as he stood in the crease and caromed across the goal line.
Carlsson scored into an empty net at 17:26 for the 5-2 final.