ATLANTA (AP) - The Braves had been 9-1 against Miami before the Marlins snapped a five-game losing streak. The Marlins' struggling offense, shut out in a 1-0 loss to Atlanta in the series opener, had 15 hits, including homers by Harold Ramirez and Starlin Castro.
Rivera was hitting .125 with one RBI before his line-drive single to left field drove in Garrett Cooper and Castro.
Caleb Smith (4-4) allowed four runs, three earned, in six innings in his first start since June 6.
Sergio Romo gave up an infield single to Nick Markakis to open the ninth before recording three straight outs for his 16th save in 17 chances.
Atlanta couldn't take advantage of a scoring opportunity against Nick Anderson in the eighth. With one out, Ozzie Albies doubled off the center field wall and moved to third on Freddie Freeman's single. Josh Donaldson hit into a double play to end the inning.
Ronald Acuña Jr., who will participate in Monday's All-Star Home Run Derby, led off the first inning with his 21st homer. Rookie Austin Riley homered in the second, but the Atlanta offense lost its momentum after a run-scoring single by Markakis in the third gave the Braves a 4-2 lead.
The NL East-leading Braves began the day 6 ½ games ahead of second-place Philadelphia.
Max Fried (9-4) allowed five runs on 11 hits, including the homers by Ramirez and Castro, in five innings. He was given his first loss since May 28 against Washington. The left-hander had two wins and four no-decisions in June.
Smith, who had been on the injured list since June 7 with left hip inflammation, was activated before the game. The Marlins optioned right-hander Jeff Brigham to Triple-A New Orleans.
Marlins: Cooper left the game in the sixth with cramping in his right leg. JT Riddle entered the game as a pinch-runner after Cooper's single to left field. ... 3B Brian Anderson (elbow contusion) missed his fourth straight start and popped out to right field as a pinch-hitter in the seventh.
Braves: RHP Anthony Swarzak had no problems after throwing on Friday. He could return by the end of next week. ... As expected, SS Dansby Swanson (sore left quadriceps) was rested for the second straight game. He is expected to start on Sunday.
Marlins: RHP Trevor Richards (3-9, 4.02) is 0-1 with a 3.45 ERA in three career starts against the Braves. In his only start at SunTrust Park, he allowed five runs in 4 1/3 innings on Aug. 14, 2018.
Braves: LHP Dallas Keuchel (1-2, 4.08) will make his fourth start since signing with Atlanta.