CHICAGO -- Adam Wainwright's bid to be the National League's first 13-game winner was denied Sunday night, but the St. Louis Cardinals still reclaimed the National League Central lead with a 10-6 victory over the Chicago Cubs.
Carlos Beltran doubled with one out in the ninth, reached third on an error and scored what proved to be the winning run on Allen Craig's single to left off Cubs closer Kevin Gregg.
Yadier Molina then tagged Gregg for a three-run homer moments later to score Craig and David Freese to put the game out of reach.
The Cubs had tied the score at 6 the previous inning when Cody Ransom's pinch-double off Cardinals reliever Edward Mujica drove in two runs.
In the sixth, Darwin Barney erased Wainwright's carefully preserved 3-1 lead with a three-run homer as the Cubs went ahead for the first time in the game.
Wainwright left trailing after six innings but ended up with no decision after the Cardinals rallied with two runs in the seventh for a 5-4 lead and added an insurance run in the eighth.
Mujica (2-1) pitched 1 1/3 innings for the win. He allowed one hit. Gregg (2-2) took the loss after working one inning and giving up four runs and four hits.
The victory left St. Louis (57-36) with a one-game lead over Pittsburgh in the NL Central heading into the All-Star break. Chicago is 42-51, a four-win improvement over this point in 2012.
Barney's sixth home run of the season dropped into the basket in left field and brought home Dioner Navarro and Brian Bogusevic for the 4-3 lead.
But the advantage was short-lived. In the seventh, Molina scored off Pete Kozma's bloop single to left off Matt Guerrier for a 4-4 tie.
Guerrier was pulled with two out and runners on first and third for left-hander James Russell, who gave up an RBI single to Matt Carpenter that brought home Kozma for a 5-4 Cardinals edge.
Adams' two-out double in the eighth inning off right-hander Blake Parker scored Freese for an 6-4 lead.
The Cubs had newcomer Cole Gillespie on second and Barney on first in the eighth when Ransom's pinch-double off Cardinals reliever Trevor Rosenthal brought them home for a 6-6 tie.
Wainwright (12-5) delivered 111 pitches through six full innings. He allowed four earned runs and eight hits, struck out four and walked one.
Cubs starter Travis Wood worked 5 2/3 innings. He allowed three earned runs and 10 hits, walked three and struck out one and had no decision.
St. Louis had a season-high 21 hits off seven Cubs pitchers as Craig went 4-for-5, Molina was 4-for-6 with four RBI and Kozma had three hits.
Barney had three hits and Luis Valbuena added two for Chicago.
Wood surrendered three hits in the first inning and Molina gave the Cardinals a 1-0 lead with two outs when he singled home Beltran from second.
With one out in bottom of the inning, Starlin Castro collected his second triple of the season. But no run resulted as Anthony Rizzo grounded out to second and Alfonso Soriano flied out to center.
St. Louis had Jon Jay in scoring position with two out after he singled and advanced on Wainwright's sacrifice bunt. Wood then walked Carpenter but got out of the inning when Beltran grounded to short.
Barney tied the score in the second with a two-out base hit up the middle that scored Dave Sappelt, who had reached on a double to left.
In the third, Kozma's two-out bunt down the third-base line drove in Molina from third to give the Cardinals a 2-1 lead. Wood then walked Jay to face Wainwright, who popped up to short center.
Freese made it 3-1 in the fourth. His two-out infield single bounced down the third-base line and brought home Craig from second.
NOTES: The Cubs added Gillespie to the 25-man active roster and designed RHP Henry Rodriguez for assignment. Gillespie was claimed off waivers on Saturday from the Giants. Rodriguez was 0-1 with a 4.09 ER) in 22 relief appearances with the Nationals and Cubs. ... Soriano led the Cubs with 16 homers and 10 stolen bases after Saturday's games, the fifth Cub and first since Sammy Sosa (1998) to enter the break atop both categories. Sosa had 33 homers and 10 steals. ... Beltran entered the game 10th in the National League in batting (.309) and was hitting .308 (4-for-13) in the series. ... Sundays are the only days of he week the Cardinals have a losing record. They were 6-8 entering the series finale. Tuesdays are the best with a 10-4 record this season. ... Kouzma broke out of an 0-for-28 slump with his RBI bunt in the third inning.