Updated

Chris Carpenter and the St. Louis Cardinals completed one of baseball's greatest comebacks, clinching the NL wild card Wednesday night with an 8-0 win over Houston and a later loss by Atlanta.

The Cardinals got their playoff spot when the Braves fell to Philadelphia 4-3 in 13 innings.

St. Louis trailed Atlanta by 10 1/2 games on Aug. 25. The Cardinals won 23 of their last 31 games.

The Cardinals will open the postseason on Saturday at NL East champion Philadelphia. In the other NL playoff matchup, Arizona visits Milwaukee.

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.

"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.

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.

Only three weeks ago, the Cardinals had virtually lost all hope.

"There was absolute doubt from us," 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."

The Cardinals 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.