The St. Louis Cardinals and Tampa Bay Rays clinched the wild-card spots on a wild Wednesday night around four major-league cities.
Chris Carpenter and the St. Louis Cardinals earned the NL wild card when they beat the host Houston Astros 8-0 and the Philadelphia Phillies beat the host Atlanta Braves 4-3 in 13 innings.
The Cardinals and Atlanta began the day even in the wild-card race.
In the American League, the Boston Red Sox and Tampa Bay Rays went into the final day tied for the AL wild-card spot.
The Red Sox, one strike away from victory. lost to the Baltimore Orioles 4-3 in the ninth inning. A few minutes later, Evan Longoria's walk-off homer in the 12th gave the Rays an 8-7 win over the New York Yankees.
The thrilling finish eliminated the need for one-game tiebreakers on Thursday.
This is the third time in the wild-card era where a pair of playoff spots were open going into the last day, STATS LLC said. In 1995, the Angels, Yankees, Astros and Rockies were still competing; in 2005, the Indians, Red Sox, Phillies and Astros were in play.
The Yankees will host the Detroit Tigers in an AL playoff opener on Friday night, the Philadelphia Phillies will be home for Game 1 in the NL against St. Louis on Saturday.
Detroit and Texas had clinched AL spots, Milwaukee and Arizona had earned them in the NL. But no pairings had been set as those division champions scrapped for home-field advantage, down to the last out.
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½ games on Aug. 25.
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.
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 there, 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 televisions in the clubhouse after their victory. They were loose and relaxed — and confident — before the game.
Champagne was ordered for a potential post-game 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½ games out, that's a hole you can't climb out of," he said, "unless you get a lot of help."
In the Braves-Phillies game, Braves closer Craig Kimbrel surrendered the tying run in the ninth, and Hunter Pence came through with a two-out, run-scoring single in the 13th to give the Phillies a 4-3 victory that ended the Braves' season Wednesday night without a trip to the playoffs that looked like a certainty just a few weeks ago.
The game ended more than an hour after St. Louis routed Houston 8-0 to claim at least a share of the wild card. The Cardinals earned it outright when David Herndon earned his first career save by getting Freddie Freeman to hit into a double play.