PHOENIX -- Chris Iannetta homered twice and drove in a career-high eight runs and the Arizona Diamondbacks outslugged the Miami Marlins 13-11 on Friday night.
J.D. Martinez and Christian Walker also homered for the Diamondbacks, who can clinch their first postseason berth in six years with a win Saturday and a loss by St. Louis.
Arizona erased a 9-7 deficit with five runs in the sixth.
Walker hit his first career pinch-hit homer to center off Jarlin Garcia to make it 9-8. David Peralta reached on an error before Dustin McGowan struck out A.J. Pollock. But Paul Goldschmidt walked and Martinez reached on an infield single ahead of Iannetta, who homered onto the walkway above the center-field fence to put the Diamondbacks ahead 12-9.
Iannetta's grand slam was his fifth and first since May 28, 2015. He hit multiple homers in the same game for the third time.
J.J. Hoover (2-1) pitched a perfect sixth for the win, his 11th scoreless appearance in his past 12 outings. Fernando Rodney pitched the ninth for his 39th save and 300th of his career.
McGowan (8-2) took the loss, giving up three runs, two hits and a walk with two strikeouts.
Giancarlo Stanton had a sacrifice fly and Christian Yelich added an RBI single in the eighth as the Marlins pulled within 12-11. But Martinez homered in the bottom of the inning, his 42nd of the season, 26th with the Diamondbacks and 13th in the month of September.
Marcell Ozuna recorded his fifth career multi-homer game for the Marlins, who had won three straight.
Ozuna gave the Marlins a 2-0 lead in the first with a two-out homer against starter Zach Greinke. The Diamondbacks answered in the bottom of the inning, taking a 3-2 lead on Iannetta's first home run.
Miami turned a single and two doubles into two runs in top of the second to go back on top 4-2 but the Diamondbacks used six hits, including a double by Greinke, to score four and move ahead 7-4.
The Marlins rallied again, tying the game 7-7 on a line-drive, three-run homer into Miami's left-field bullpen by Justin Bour. Ozuna's second home run, a two-out shot in the fourth, made it 8-7 and J.T. Realmuto singled and scored in the fifth to give the Marlins a 9-7 lead.
Greinke allowed a season-high eight runs and nine hits over four innings, only his second outing of fewer than five innings this year. Greinke struck out three and walked two.
Adam Conley lasted only 1 2/3 innings, allowing seven runs, six hits and a walk. Conley had given up seven runs total in his past two starts combined.
The Diamondbacks have hit four-plus homers in consecutive games for the fourth time in club history and first time since 2006.
Realmuto was called out in the top of the seventh trying to stretch a single into a double. Marlins manager Don Mattingly asked for a replay review and the call was reversed. Mattingly has been successful on 15 of 32 challenges this season.
Diamondbacks INF Chris Owings (fracture right middle finger) will not return during the regular season. Arizona had hoped to have Owings back for the season's final series against Kansas City but it hasn't healed properly.
— FOX Sports Arizona (@FOXSPORTSAZ) September 22, 2017
Marlins: LHP Dillon Peters (0-2, 5.40) will try again for his first career win as he makes his fifth start. Peters has struggled with his control, walking 12 in 21 2/3 innings and allowing 36 baserunners overall.
Diamondbacks: RHP Taijuan Walker (9-8, 3.45) has posted a 3-1 record and 2.14 ERA in his past six starts with 31 strikeouts in 33 2/3 innings. Walker will be facing the Marlins for the first time.