The Cardinals and Atlanta began the day even in the wild card race. When St. Louis finished, the Braves were tied with Philadelphia in extra innings.
If the Cardinals and Braves wind up even, they would play a one-game tiebreaker in St. Louis on Thursday night.
Carpenter (11-9) struck out 11 and allowed two hits in his 15th career complete-game shutout as St. Louis kept up its improbable September charge. The Cardinals won for the 23rd time in 31 games, having trailed Atlanta by 10 1/2 games on Aug. 25.
"We had nothing to lose. We were already out of it," Carpenter said. "People were telling us we were done. We decided to go out and play and not embarrass ourselves and do what we can. We played ourselves back into it."
The Cardinals poured onto the field after Carpenter fielded J.D. Martinez's weak grounder for the final out. The celebration was brief and muted, as the team raced into the clubhouse to watch the end of the game in Atlanta.
"It was exciting, there's no doubt about it," Carpenter said. "The way these guys have played the past month and a half has been amazing, every single night grinding, playing their butts off, not giving up.
"We continued to give ourselves an opportunity and now we are here."
The teams entered Wednesday's regular-season finales with 89-72 records.
Kyle Lohse (14-8) would start for the Cardinals against Brandon Beachy (7-3) for the Braves, who played the Phillies.
Atlanta's game started an hour earlier, but the Cardinals virtually took away any hope for a Houston victory in the first inning of their contest, jumping to a 5-0 lead against Brett Myers (7-14).
Albert Pujols and Lance Berkman drove in runs with singles, and David Freese doubled to left-center before Myers even recorded an out. Berkman scored when Skip Schumaker's hard grounder ricocheted off Myers' glove for an infield hit, and Freese came home on Nick Punto's single to right.
Carpenter handled the rest.
He had struggled at Minute Maid Park lately, going 0-3 with a 4.62 ERA in his last five starts here, but he was in total command from the start on Wednesday, striking out five of the first nine hitters he faced. He also had an RBI single in the third to drive in Freese, who reached base when right fielder Brian Bogusevic dropped his fly ball for an error.
Freese led off the fifth with a double to right center, the Cardinals' 10th hit of the game. Myers, 4-0 with a 1.24 ERA in his last five starts, hadn't allowed more than nine hits in a start since Aug. 6.
Freese later scored on Schumaker's groundout to shortstop Clint Barmes for a 7-0 lead, equaling the most runs given up by Myers in 33 starts this season. Wilton Lopez replaced Myers for the start of the sixth.
As the Astros batted in the seventh, the left-field scoreboard posted a 3-3 tie in the Phillies-Braves game, prompting a roar from the large contingent of Cardinals' fans in the stands behind the St. Louis dugout.
Carpenter then struck out Bogusevic and Jimmy Paredes to wrap up another easy inning. Allen Craig hit a solo homer in the ninth off Lance Pendleton.
The Cardinals huddled around a television in the clubhouse cafeteria after their victory. They were loose and relaxed -- and confident -- before the game.
Champagne was ordered for a potential postgame celebration and someone wrote, "Happy Flight! After Game" on a marker board in the clubhouse.
Only three weeks ago, the Cardinals had virtually lost all hope.
"There was absolute doubt from us," shortstop Nick Punto said. "I remember early on in September, we were like, 'Let's just finish up strong for the fans. Let's give them something to come out and watch.'
"When you're 10 1/2 games out, that's a hole you can't climb out of," he said, "unless you get a lot of help."
NOTES: Cardinals manager Tony La Russa said LF Matt Holliday (right hand injury) and SS Rafael Furcal (left hamstring) were unavailable on Wednesday night. ... Cardinals pitching coach Dave Duncan rejoined the team after missing more than a month to tend to his ailing wife. Jeanine Duncan is recovering from surgery on Aug. 21 to remove a brain tumor. Dave Duncan, La Russa's trusted assistant since the early 1980s, did not know how long he would be able to stay with the club because his wife has more medical appointments scheduled. ... The sparse crowd offered a standing ovation to Astros owner Drayton McLane after a video tribute was shown on the giant scoreboard between the second and third innings. McLane is still waiting for Major League Baseball to approve his sale of the team to Houston businessman Jim Crane for $680 million. General manager Ed Wade said before Wednesday's game that McLane still has the final say on all baseball decisions.