Freddie Freeman homered for the NL East-leading Braves, who totaled five runs while dropping three in a row for the first time since July 3-5. Julio Teheran (10-7) allowed a season-worst five walks and was charged with four runs.
Miller (12-8) worked more than six innings for the first time in 13 starts since June 1. He struck out six without walking a batter while pitching with no more than a one-run cushion against a fellow 22-year-old right-hander. Center fielder Jon Jay made a leaping catch at the wall to rob Brian McCann of at least extra bases in the seventh.
St. Louis totaled three runs while getting swept in a three-game series in Atlanta in late July.
Pinch-hitter Shane Robinson and Carpenter opened a three-run seventh with singles to chase Teheran and the Cardinals broke it open against reliever Dave Carpenter with a two-run double by Matt Holliday and an RBI single by Yadier Molina for a 5-1 lead.
The Braves had three of their seven hits in the ninth, including pinch-hitter Gerald Laird's RBI double off Seth Maness before Edward Mujica struck out Elliott Johnson with two on for his 34th save in 36 chances.
The first three hits of the game were home runs. Miller struck out the first two batters on seven pitches and the Braves' first contact came when Freeman hammered a 1-2 pitch for his 16th homer.
Carpenter answered with his second career leadoff homer and 10th overall, also on a 1-2 count, in the bottom of the first. Beltran's team-leading 23rd put the Cardinals ahead 2-1 in the third and he finished with three hits, two RBIs and his second base-running gaffe of the series.
Beltran settled for a single in the fifth after standing at the plate for several seconds and belatedly jogging to first on a liner down the third base line that caromed off the jut in the stands in shallow left. Two days earlier he missed third base and had to double back before scoring.
NOTES: Miller walked nine in 16 1-3 innings his first four starts this month, one of them lasting just two pitches when he took a liner off the elbow. Missouri DE Kony Ealy threw a ceremonial first pitch. ... The Cardinals have hit 21 homers in August after totaling nine in July, although Carpenter's 10th overall was his first since July 10 against Houston. ... The Braves are 8-31 when scoring two or fewer runs.
Link to box score: St. Louis 6, Atlanta 2
Link to game discussion at The Cardinal Nation message board