Former Marlins manager Mike Redmond, now a bench coach for Colorado, directed the Rockies. The Rockies announced that manager Bud Black missed the game because he was "under the weather."
Redmon is expected to return Sunday as Miami (55-60) goes for the series sweep against Colorado (65-51), which has lost four of its past five games.
Stanton has 41 homers, one short of the franchise season record set by Gary Sheffield in 1996. Stanton has 20 homers in the past 32 games.
The homer by Stanton snapped a 1-1 tie in the fourth inning. Overall, Stanton went 3-for-4 with three RBIs and two runs scored, falling just a triple short of a cycle.
Center fielder Charlie Blackmon led Colorado with four hits and two steals. He led off an inning five times and went 4-for-5, with Marlins first baseman Tyler Moore robbing him of a hit on his final at-bat in the ninth.
Miami's Justin Nicolino (1-1) allowed six hits, four walks and two runs (one earned) in 5 1/3 innings. He posted his first win at Marlins Park since May 3, 2016.
Jeff Hoffman (6-4) took the loss, allowing seven hits, three walks and four runs. He is winless in his past five appearances, including three losses.
Both teams scored in the first inning.
Blackmon led off the game with a single, stole second, advanced to third on a flyout and scored on Mark Reynolds RBI single to give Colorado a 1-0 lead.
Miami tied the score 1-1 when Stanton doubled, advanced to third on a wild pitch and scored on Marcell Ozuna's groundout.
After Stanton's two-out homer gave Miami a 4-1 lead, Colorado got one run back. Blackmon singled and stole second base again, advanced to third on a throwing error by catcher J.T. Realmuto and scored on DJ LeMahieu's sacrifice fly.
Colorado cut its deficit to 4-3 in the eighth. Reynolds drew a five-pitch walk, advanced to third on a Jonathan Lucroy single and score on a Carlos Gonzalez groundout. Pinch-hitter Ryan McMahon, making his major-league debut, flied out to the edge of the warning track in center, ending the threat.
Brad Ziegler, who escaped a two-on jam, pitched a scoreless ninth for his fourth save.
NOTES: Colorado signed 1B Ryan Howard, 37, to a minor-league contract. Howard, who twice led the majors in homers, had been out of baseball since being released by the Atlanta Braves on May 8. ... Since 2000, only two players -- David Ortiz in 2006 and Chris Davis in 2013 -- have reached 40 homers quicker than Marlins RF Giancarlo Stanton, who accomplished the feat on Friday. ... When rosters can expand to up to 40 players on Sept. 1, look for the Marlins to promote 3B Brian Anderson, who is hitting .267 with 20 homers and 72 RBIs this year between Double-A and Triple-A. ... Rockies 3B Nolan Arenado and CF Charlie Blackmon rank 1-2 in the majors in extra-base hits. In baseball history, teammates have finished 1-2 in the majors in extra-base hits just three times: Babe Ruth and Lou Gehrig in 1926 and 1927 and Tony Armas and Dwight Evans for the 1984 Boston Red Sox.