Stanton has 579 RBIs, one more than former Marlins third baseman Mike Lowell. It was Stanton's 15th homer of the season.
The Marlins (22-32) also got homers from Christian Yelich, his seventh, and Justin Bour, his team-high 16th. Miami has won five of its past six games.
Arizona (34-23) got a home run and three RBIs from Paul Goldschmidt.
Reliever Dustin McGowan (3-0) earned the win with 1 2/3 innings of scoreless relief. A.J. Ramos pitched a scoreless ninth to earn his seventh save.
Arizona starter Patrick Corbin (4-6) took the loss. Corbin, who had a 2.29 ERA in April and a 9.00 ERA in May, allowed nine hits and six runs (five earned) in five innings.
Stanton is hitting .357 (5-for-14) with two homers in his career against Corbin.
Miami opened the scoring with two runs in the first. Stanton doubled off the wall in left and Yelich pulled a two-run homer that landed in the upper deck in right. Bour followed with a two-run blast to double the lead.
Arizona cut its deficit to 4-2 in the third. With two outs, David Peralta singled and scored on a two-run homer by Goldschmidt. It was Goldschmidt's13th homer of the year.
Miami extended its lead to 5-2 in the fourth. J.T. Realmuto doubled, advanced to third on a fielding error by Arizona shortstop Chris Owings and scored on a groundout by JT Riddle.
Arizona tied the score 5-5 in the fifth. Chris Iannetta hit a leadoff homer, and Goldschmidt and Jake Lamb added RBI singles.
NOTES: The Marlins have established a trust to assist the family of the late Jose Fernandez, a two-time All-Star pitcher with Miami who died in a boat crash in September. Marlins president David Samson said Fernandez's infant daughter, Penelope, will have her college education paid for. ... Marlins 3B Derek Dietrich was rested. ... RHP Zack Greinke is 20-10 since signing with Arizona. He joins Roger Clemens and Bob Caruthers as the only pitchers in major league history to win at least 20 of their first 30 decisions with three different teams. ... Arizona CF Gregor Blanco (left thumb) did not start on Friday after getting hurt on Thursday. ... Diamondbacks CF A.J. Pollock (groin) is expected to return within two weeks. ... Arizona OF Socrates Brito (dislocated finger on left hand) is hitting .357 in eight rehab games.