ST. LOUIS (AP) Matt Carpenter returned to his comfort zone Thursday night.
Carpenter hit a pair of home runs and Greg Garcia's bases-loaded walk capped a three-run rally in the ninth inning as the St. Louis Cardinals beat the Colorado Rockies 9-8.
Carpenter went 4 for 5 with four RBIs after moving back to the leadoff spot. It was his first career multihomer game and he has a career-high 12 home runs this season.
''I'd be lying if I said I wasn't comfortable there,'' Carpenter said. ''It's not to say that I can't hit in other positions. Today might have bought myself a couple of more games there.''
Carpenter is hitting .370 (34 for 92) with six homers and 17 RBIs in the leadoff position. He hit .225 (56 for 249) with six homers and 33 RBIs in the 2-hole.
''Leadoff spot fit him well today,'' manager Mike Matheny said. ''What a great day. Even the out he made was hit on the screws. That just shows if you stay with it, it's going to come around. That was just a great display of everything we saw in the first part of the season.''
Jhonny Peralta's two-run single off Rockies closer John Axford tied the game at 8-all and Garcia's walk scored Kolten Wong as the Cardinals recorded their seventh walk-off win of the season.
Axford (3-5) took his third loss in his last four outings.
''We knew Axford had been going through a rough patch,'' Carpenter said. ''We just wanted to get the tying run to the plate and see what happened.''
Cardinals starter Carlos Martinez gave up five runs on 10 hits in five innings. Carlos Villanueva (4-3) earned the win.
The Cardinals snapped a two-game skid and improved to a major league-best 38-15 at home.
The Rockies are 3-15 at Busch Stadium since 2010 and haven't won in St. Louis since May 12, 2013.
The Cardinals ended a 22-inning scoreless streak when Wong's groundout scored Carpenter in the first.
Carpenter's 423-foot homer to dead center in the second gave the Cardinals a 4-1 lead and his solo shot in the fifth tied it at 5.
Nick Hundley's 442-foot home run to left in the sixth tied the game at 6. The Rockies capitalized on a pair of throwing errors by Kevin Siegrist to snap that tie with two runs in the eighth.
Nolan Arenado drove in his major league-leading 78th run in the first.
''We battled really well offensively,'' Rockies manager Walt Weiss said. ''We did in Chicago too the last series. I think we've linked together a lot of good at-bats, we did it again tonight.''
Rockies starter Chris Rusin erased one of his mistakes to Carpenter by hitting his first major league home run to tie the game in the fourth. Rusin, who gave up six runs in five innings, became the third opposing pitcher to go deep against Cardinals pitching this season.
Rockies: Left fielder Corey Dickerson left the game with a right rib contusion after diving while trying to catch Jason Heyward's triple in the fifth. His status is day-to-day.
Cardinals: Matt Holliday was placed on the 15-day disabled list after suffering a Grade 2 strain of his right quad during Wednesday's game against the Reds. It is the same injury that sidelined Holliday for 31 games earlier this season.
Things got heated after Martinez hit DJ LeMahieu with a pitch to load the bases in the fifth. LeMahieu had words for Martinez while being escorted to first by Yadier Molina.
After being stranded at third when the inning ended, Arenado then exchanged words with Molina.
''It wasn't an accident,'' LeMahieu said. ''I hit the ball back at him the at-bat before and I guess he thought I tried to hit it back at him or something. I'm not sure, but he was starring me all the way down so I don't know.''
Martinez, through an interpreter, apologized for his role in the incident, which included a hand gesture toward the Rockies dugout.
''We talk about anything our guys do that looks out of the ordinary,'' Matheny said. ''I'm not going to take emotion out of these guys, but part of our job is to teach them what kind of emotions we should be displaying that are going to help you move forward and help your team move forward. That's a learning process.''
Rockies: RHP Kyle Kendrick (4-11, 6.33 ERA) is making his 11th start on the road, where he is 2-6 with a 5.52 ERA.
Cardinals: RHP Michael Wacha (11-4, 3.27 ERA) is making a career-high 20th start and has gotten the most run support in the National League (6.16 runs a start).