Miami Marlins’ Jon Berti watches after hitting a double during the third inning of a baseball game against the Los Angeles Dodgers, Thursday, Aug. 15, 2019, in Miami. (Lynne Sladky/Associated Press)

MIAMI — The Miami Marlins turned the tables on the Los Angeles Dodgers in their rout-filled season series, winning 13-7 Thursday afternoon despite giving up four home runs, including Cody Bellinger’s 40th.

The Dodgers increased their homer total this week at pitcher-friendly Marlins Park to 14, a franchise record for a three-game series. Max Muncy hit his 29th, Corey Seager his 12th and Kyle Garlick his third.

Bellinger, who began the day tied with Christian Yelich and Mike Trout for the major league lead, reached the 40 mark for the first time with a three-run shot into the upper deck in the seventh inning to cut the deficit to 13-7.

Los Angeles had won the previous five games against Miami this year by a combined score of 45-9, including a margin of 33-2 in the past three games.

But the Marlins averted a three-game sweep and won the season’s final matchup between the teams with the best and worst records in the National League — and did it without hitting a home run.

Brian Anderson, Starlin Castro, Jorge Alfaro and Lewis Brinson each had three RBIs for Miami, and Jon Berti scored three times as the game literally became the latest laugher in the series. Castro wore a grin crossing the plate in the fifth to make it 7-1.

The last time Marlins had four players with three or more RBIs was in 2006.

Caleb Smith (8-6) needed 106 pitches to get through five innings but allowed only one hit and one run — on Garlick’s homer in the fifth.

Walker Buehler (10-3) allowed five runs in four-plus innings. It was a rare lapse for a rotation that entered the game with a 1.69 ERA this month.

The longest nine-inning game in the eight-year history of Marlins Park took 4 hours, 7 minutes.

Anderson drove in the game’s first run with an RBI bloop single in the first. His two-run double in the fifth made it 4-0 and knocked Buehler out of the game.

The Marlins’ first seven batters reached in the fifth, and six scored. Brinson’s two-run double made it 8-1.

Brinson also charged to making a diving, inning-ending catch in center field and rob Seager of an RBI single in the fourth.

TURNING TWO

Heady defense by Dodgers 3B Justin Turner and a mental mistake by Smith helped Buehler in the fourth. When Smith popped up trying to bunt with a runner at first, Turner let the ball drop, and because Smith stopped a few steps from the plate, the Dodgers turned an easy 5-6-3 double play.

TRAINER’S ROOM

Dodgers RF Kristopher Negrón (nose and forehead bruises and abrasions) left the game when he did a face plant in a vain attempt to catch Brinson’s double.

UP NEXT

Dodgers: RHP Kenta Maeda (8-8, 4.12) is scheduled to start the opener of a three-game series at Atlanta on Friday. Maeda last faced the Braves in 2017 but has won both of his starts against them.

Marlins: A six-game trip begins Friday with All-Star RHP Sandy Alcantara (4-10, 4.44) scheduled to start at Colorado. In his past eight starts, Alcantara is 0-4 with a 7.29 ERA.

___

More AP MLB: https://apnews.com/MLB and https://twitter.com/AP_Sports

___

Follow Steven Wine on Twitter: http://twitter.com/Steve_Wine.

Copyright 2019 The Associated Press. All rights reserved. This material may not be published, broadcast, rewritten or redistributed.