ST. LOUIS -- The Atlanta Braves used a two-run rally in the ninth to end their road trip with a win.
Ryan Doumit scored on a wild pitch and the Braves got two runs in the ninth inning to rally past the St. Louis Cardinals for a 6-5 win.
The Braves have been held to two runs or fewer 19 times, but they managed to score twice off St. Louis closer Trevor Rosenthal (0-2) to take the game Sunday.
"We got a happy flight," said Atlanta first baseman Freddie Freeman, who reached base four times. "We grinded all day and so did the offensive hitters. We never caved today and we gut one out in the ninth."
Freeman started a ninth-inning rally with a leadoff single off St. Louis closer Trevor Rosenthal (0-2).
With two outs, Freeman went to third on pinch hitter Ryan Doumit's double to right. Rosenthal intentionally walked pinch hitter Evan Gattis to load the bases and then walked Jordan Schafer to force in the tying run.
Carlos Martinez relieved Rosenthal and had a wild pitch while facing Ramiro Pena that scored Doumit to make it 6-5.
"A battle royal there at the end," Atlanta manager Fredi Gonzalez said. "We just kept getting good at-bats and it's nice to win this one. Maybe it will get us going in the right direction."
St. Louis dropped a game it was close to winning.
"It would have been a big win, no question," St. Louis manager Mike Matheny said. "They're all tough, but to have a lead in the ninth, even a slim one, that a tough one to lose."
Dan Carpenter (3-0) pitched 1 1-3 innings of scoreless relief for the win. Craig Kimbrel pitched a scoreless bottom of the ninth for his 11th save in 13 chances. The save was the 150th of Kimbrel's career.
Cardinals starter Jaime Garcia pitched seven innings in his first outing in more than a year.
Garcia, who underwent surgery in May 2013 to repair a torn labrum and rotator cuff in his pitching shoulder, allowed four runs and five hits with five strikeouts. The outing was Garcia's 100th appearance in the major leagues, but first since May 17, 2013.
"I made some good pitches, I made some mistakes," Garcia said. "I had some butterflies going on in the first inning, but nothing different."
Kolten Wong drove in three runs with a bases-loaded double in the second inning.
Freeman went 3 for 3, including a solo home run in the first and a two-run single in the sixth.
Justin Upton homered leading off the fourth for the Braves. The homer was the 10th for Upton, who also doubled and scored two runs.
"It's big," Freeman said. "I don't know if you can say a must win, but it's definitely nice to get one."
The Braves failed twice to close out innings due to defensive miscues with two outs. That allowed the Cardinals to score four runs.
With two outs in the seventh and Yadier Molina on first, Jhonny Peralta hit a high fly ball to center field. Schaefer lost the ball in the sun and it fell just to his right side. Peralta was credited with a double and Molina scored to give the Cardinals a 5-4 lead.
In the second inning, Braves starter Gavin Floyd appeared headed for an easy second inning when he struck out Peter Bourjos for what would have been the third out.
But the ball got away from catcher Gerald Laird for a passed ball, allowing Bourjos to reach first. A hit by Garcia and a walk to Matt Carpenter loaded the bases and Wong cleared them with a double down the line in left to make it 3-1.
Atlanta rallied to tie the game 4-4 on Freeman's two-run single with one out in the sixth.
NOTES: Molina extended his hitting streak to seven games with a fifth-inning single. ... Atlanta's Dan Uggla went 0 for 3, dropping his average to .178. Uggla has just two hits in his past 29 at-bats. ... Pat Neshek got one out in the eighth inning to extend his scoreless streak to 13 2-3 innings.