ATLANTA — The Miami Marlins began the season thinking they had all the pieces in place to make a run at the playoffs.
Instead, they watched the Atlanta Braves lock up a spot for themselves.
Freddie Freeman hit a two-run homer off Mike Dunn in the bottom of the ninth inning to put Atlanta back in the playoffs with a 4-3 victory over the Marlins on Tuesday night.
"We've lost a lot of games and to lose that game like that is heartbreaking, especially with the way the team played today," Dunn said. "They battled."
Freeman's dramatic drive clinched at least a National League wild-card berth for the Braves, who squandered a big lead in the wild-card race with a huge collapse last September.
Longtime Braves star Chipper Jones, who plans to retire at the end of the season, led off the ninth with a double. He moved to third on a wild pitch by Dunn (0-3) and scored when Freeman's 22nd homer easily cleared the center-field wall.
"We just fought and never gave up," Dunn said. "Then to have the lead going into the ninth and to give it up to two hitters, it (stinks)."
Donovan Solano hit his first career homer in the second for Miami and followed with a two-run shot in the seventh to make it 3-2.
Craig Kimbrel (3-1) worked a scoreless inning to help the Braves win their 22nd straight game started by Kris Medlen. The streak is the longest in the majors since the New York Yankees won 22 consecutive games started by Whitey Ford in 1950 and '53.
Returning to the postseason helps wipe away some of last season's frustration for the Braves, who blew an 8½-game lead in the wild-card standings and finished September 9-18. They missed the playoffs after one of the biggest meltdowns in baseball history.
Last winter, the Marlins spent lavishly to add Jose Reyes, Mark Buehrle and Heath Bell and put a shine on their new stadium in Little Havana.
Instead, the year will end with several big names such as Hanley Ramirez playing elsewhere. The Marlins are last in the NL East.
Atlanta cruised most of the way this year and wrapped up a postseason spot with more than a week to spare. And the Braves still have a chance to catch first-place Washington in the NL East. They moved within four games of the Nationals, who lost to Philadelphia 6-3, with eight to play.
Four of the five NL playoff spots are secured. In addition to Atlanta, Washington, Cincinnati and San Francisco have all punched their tickets to the postseason.
The second-place Braves have a comfortable cushion in the wild-card race, and St. Louis leads the chase for the league's second wild card.
Jones went 1 for 2 with two runs and a sacrifice fly that made it 1-all in the second. He is batting .296 and has 14 homers with 63 RBIs. His leadership has been unmistakable in a season that included a final All-Star appearance.
The Braves tied it 1-all in the second. Jones walked, moved to second on Freeman's single and scored from second on Dan Uggla's single.
After Martin Prado's two-out triple in the third, Marlins starter Nathan Eovaldi struck out Heyward, but Heyward tripled with one out in the sixth and scored on Jones' sacrifice fly to give the Braves a 2-1 lead.
Eovaldi was trying to win for the first time in six starts. He allowed four hits, two runs and two walks in six innings. He struck out eight.
"I was just able to use all four of my pitches," Eovaldi said. "I kept throwing the curveball. I didn't throw too many for strikes, but I just kept throwing it and was able to get the ball inside and away. I was able to locate it up. The changeup was setting up the slider. I felt that was key for me."
Medlen did not win for the first time in nine starts, allowing five hits, three runs, no walks and striking out eight. The right-hander began the game with a 15-0 record over his last 27 starts dating to May 31, 2009.
NOTES: Reyes went 3 for 4 to push his average to .317 in a span of 271 at-bats since the All-Star break. ... Marlins manager Ozzie Guillen said RF Giancarlo Stanton, who has missed the last six games with a sore left ribcage, is lobbying to return to the lineup soon. Stanton took batting practice before the game. ... The Marlins were waiting for MRI results on OF Justin Ruggiano, who has been out since last Friday with a right shoulder sprain.