Colorado had its four-game win streak snapped, falling back under .500 at 38-39. Gerardo Parra led the Rockies with two RBIs, including his fourth homer of the season.
Miami, which is in last place in the National League East, broke its three-game losing streak in a battle between two franchises celebrating their 25th-year anniversary.
Derek Dietrich, who was not in the original starting lineup, had a solo home run for the Marlins. He was inserted into the lineup when shortstop Miguel Rojas was scratched due to a left hand contusion.
That caused manager Don Mattingly to alter the position of three other players while also taking the lefty-hitting Dietrich off the bench and putting him in left field against Colorado southpaw Tyler Anderson.
Since May 31, Dietrich has been hot, batting .384.
Rookie right-hander Trevor Richards (2-4) earned the win, allowing three hits, two walks and one run in six innings. He struck out eight.
Anderson (4-3) allowed seven hits, two walks and four runs in six-plus innings. He struck out eight.
Anderson was especially impressive for his first 3 2/3 innings, striking out seven and allowing one hit and no runs. But one pitch after striking out Cameron Maybin, Anderson gave up the homer to Dietrich, who pulled a cutter to right for a 1-0 Marlins lead.
It was Dietrich's 10th homer of the season, three away from his career high.
Colorado tied the score in the bottom of the fourth. Carlos Gonzalez singled, advanced to third on Trevor Story's double to left and scored on Parra's sacrifice fly.
But Miami won the game with its five-run seventh. Yadiel Rivera and Bryan Holaday singled to start the surge. Pinch hitter Justin Bour drove in the go-ahead run with an RBI single that chased Anderson.
Reliever Bryan Shaw entered the game and allowed an infield single to Starlin Castro before Realmuto drove a 2-2 cutter over the fence in right. It was Realmuto's 10th homer of the season and his second career slam.
Colorado closed its deficit to 6-2 in the bottom of the seventh as Parra hit a homer off reliever Brad Ziegler's 85 mph submarine offering.
However, relievers Drew Steckenrider and Kyle Barraclough pitched one scoreless inning each to nail down the win for Miami.
--Field Level Media
Miami | Colorado | |
Trevor Richards | Player | Tyler Anderson |
Win | W/L | Loss |
6.0 | IP | 6.0 |
8 | Strikeouts | 8 |
3 | Hits | 7 |
1.50 | ERA | 6.00 |
Miami | Colorado | |
J.T. Realmuto | Player | Gerardo Parra |
2 | Hits | 1 |
4 | RBI | 2 |
1 | HR | 1 |
5 | TB | 4 |
.500 | Avg | .500 |