Updated

Nick Punto's go-ahead RBI double in the top 4 victory over the Pirates in the game series.

Kyle McClellan (11-6) recorded the final out in the bottom of the eighth to earn the win and Jason Motte stranded a runner in scoring position in the ninth to notch his sixth save of the season.

After signing a two-year contract extension prior to the game, St. Louis starter Chris Carpenter allowed four runs on 10 hits over seven innings. He added a two-run single for the Cardinals, who remain 4 1/2 games behind Atlanta in the NL wild card race and 6 1/2 games behind Milwaukee in the NL Central.

The Braves defeated the Marlins, 7-1, on Tuesday, while the Brewers downed the Rockies, 2-1, on Ryan Braun's 11th-inning walkoff homer.

Joel Hanrahan (0-4) was saddled with the loss after allowing Punto's double and an Albert Pujols sac fly in the ninth.

Andrew McCutchen belted a game-tying home run in the seventh and Derrek Lee added a solo shot for the Pirates, losers in 11 of their last 16.

The Cardinals grabbed a 4-2 lead in the fifth on Jon Jay's RBI double. Later in the frame, Daniel Moskos relieved Pirates starter Jeff Karstens and induced Lance Berkman into an inning-ending double play.

Karstens allowed four runs on seven hits over 4 1/3 frames.

"I really didn't command my fastball very well and when I left it over the plate they were able to do some damage with it," said Karstens.

In the home fifth, Lee brought home Pedro Ciriaco with a sac fly, but after an appeal, third base umpire Sam Holbrook ruled that Ciriaco left third base early, resulting in a double play. Replays contradicted the ruling, showing that Ciriaco waited until the ball was caught before leaving third.

The Pirates persisted, however, tying the game in the seventh on McCutchen's two-run blast to right-center.

Arthur Rhodes spelled Carpenter in the eighth and recorded two outs before McClellan got Ryan Ludwick to fly out, ending the inning.

In the top of the ninth, Daniel Descalso hit a one-out single, and pinch- runner Tyler Greene scored from first on Punto's double to left-center. Later in the inning, Pujols' sac fly put St. Louis up by two.

In the Pirates' half, singles by Josh Harrison and Pedro Alvarez placed runners at first and second with no outs, but Ciriaco bunted into a force at third and Neil Walker hit into a 6-4-3 double play, ending the game.

The Cardinals, who had won five straight before dropping Monday's series opener, 6-5, took the lead in the second on Yadier Molina's one-run double and Carpenter's two-run, line drive single to center.

"It was a good, gutty, hang in there type of win, especially (after) yesterday," said Cardinals manager Tony La Russa.

Lee scored on Pujols' fielding error in the home half and made it a 3-2 game an inning later with a homer to right-center.

Game Notes

Karstens had his previous two starts skipped due to arm soreness...Pirates manager Clint Hurdle was ejected by Holbrook following the controversial appeal at third base...Pujols committed three errors.