ATLANTA (AP) At the start, it looked like a slugfest.

By the end, it came down to defense.

The Braves ad-libbed a brilliant double play to snuff out a potential Miami comeback in the ninth, moving Atlanta a step closer to a third straight NL East title with a 5-4 victory over the second-place Marlins on Monday night.

With speedy pinch-runner Monte Harrison at first, Matt Joyce hit a high chopper behind the mound that was fielded by Braves closer Mark Melancon. While he made the throw to retire Joyce, Harrison noticed third base wasn't covered and kept right on running around second.

Third baseman Austin Riley had gone after the ball and wasn't in position, but shortstop Dansby Swanson alertly took off running for the bag. First baseman Freddie Freeman hit the moving target with a perfect throw, and Swanson was able to leap at Harrison and swipe him on the left hip a split-second before he got a hand to the bag on a headfirst slide.

''I saw the ball coming right back at me really quickly. Freddie turned and launched it right over my head,'' said Melancon, who dropped to one knee to avoid getting struck. ''It was definitely a heads-up play there by Dansby. Just an athletic play all around. That was fun.''

Swanson celebrated by pounding his glove into the dirt. Brian Anderson flied out to deep right to end the game, giving Melancon his 11th save and putting the Braves in position to clinch the East title as soon as Tuesday.

''That was amazing,'' manager Brian Snitker said. ''Just amazing.''

Even with the loss that dropped them four games behind Atlanta with six to play, the Marlins are still positioned to earn their first playoff berth since 2003. But they've got a tough final week, with three more games in Atlanta and a weekend series against the New York Yankees.

''This was a playoff atmosphere,'' said Miami starter Trevor Rogers, who bounced back from a rough start to keep the Marlins in the game. ''There's obviously no fans, but this was a very, very good ballgame. It's coming down to the wire.''

Riley's two-run double capped a wild first inning in which the Marlins scored three in the top half with a barrage of singles - and the Braves responded with four runs in the bottom half. In all, the opening frame took 45 minutes and 74 pitches to get through.

There were only two more runs the rest of the way as both teams got stellar performances from their bullpens. Three Miami relievers combined for four hitless innings after Rogers (1-2) left, while the Braves surrendered only one run over the final six innings.

Tyler Matzek (4-3) pitched two hitless innings for the win, and Darren O'Day and Chris Martin each worked a scoreless frame. Will Smith escaped a bases-loaded jam in the eighth after Shane Green surrendered a two-out run. With a big assist from the defense, Melancon finished it off.

The Marlins got things rolling against Huascar Ynoa with RBI singles from Jesus Aquilar, Anderson and Garrett Cooper.

The Braves bounced right back against Rogers, who created a mess for himself by walking Ronald Acuna Jr. and Freeman to start the inning. Travis d'Arnaud brought home a run with an infield dribbler, Ozzie Albies ripped a run-scoring single to center and Riley doubled into the right-field corner to put the Braves ahead 4-3.

Both pitchers settled down after that. Ynoa faced the minimum over the next two innings before giving way to the bullpen. Rogers surrendered another run on back-to-back doubles to start the second, but the rookie avoided further trouble by getting d'Arnaud to hit into a double play.

HANGING TOUGH

Rogers, Miami's first-round pick in the 2017 draft, came back from his rough start to strike out the last six hitters he faced in his four-inning stint.

''It's huge,'' Rogers said. ''The stat line might say different, but for me personally might be my best outing as far as growing as a big leaguer.''

TRAINER'S ROOM

Atlanta left-hander Cole Hamels is done for the season, dealing a big blow to the Braves' beleaguered rotation.

The 36-year-old Hamels has spent all year struggling to bounce back from shoulder and triceps issues. He finally made his first start of the season last week at Baltimore, giving up three runs in 3 1/3 innings, and was scheduled to go Tuesday against the Marlins.

But Hamels told general manager Alex Anthopoulos shortly before Monday's game that he didn't feel like he could get anything on the ball. The Braves placed Hamels on the 10-day injured list and are seeking permission from Major League Baseball to replace him in postseason player pool.

UP NEXT

Marlins: RHP Jose Urena (0-2, 6.00 ERA) gets his fourth start of the season against a team he has annoyed in the past with his tendency to hit batters.

Braves: After being called up to replace Hamels, RHP Bryse Wilson is set to make his first start of 2020.

---

Follow Paul Newberry on Twitter at www.twitter.com/pnewberry1963. His work can be found at https://apnews.com/search/paulnewberry

---

More AP MLB: https://apnews.com/MLB and https://twitter.com/AP-Sports

Copyright 2020 STATS LLC and Associated Press. Any commercial use or distribution without the express written consent of STATS LLC and Associated Press is strictly prohibited.