(AP) A startling triple play. A spirited comeback. Huge hits by a rookie — a Yale philosophy major, at that — and monumental collapses on the brink.

After six months, 161 games and more than a half-million pitches, the playoff picture was still a blur with one day to go. Boston, Tampa Bay, Atlanta and St. Louis, desperate to play a little longer.

Talk about a fantastic, frenzied finish, more than anyone in the majors could’ve asked for. And it’s not even October yet.

"I think it’s really good for baseball," Red Sox manager Terry Francona said. "Not so good for my stomach."

The regular season was supposed to wrap up Wednesday, but surely many fans were rooting for bonus baseball. In both leagues, the possibility loomed.

Boston and the Rays went into the final day even for the AL wild-card spot, the Braves and Cardinals were deadlocked for the NL wild-card berth. If they stayed that way, the slots would be decided with one-game tiebreakers Thursday in Tampa Bay at 4:07 p.m. EDT and in St. Louis at 8:07 p.m.

Mark Teixeira struck first, hitting a grand slam off Tampa Bay All-Star David Price to put the New York Yankees ahead of the Rays. The Red Sox, meanwhile, took an early lead at Boston.

Having fun, guys?

"It’s like living out a bad dream," Braves star Chipper Jones said.

A few weeks ago, there didn’t seem to be a single race left.

The Red Sox held a nine-game lead over Tampa Bay on the morning of Sept. 4. The Braves were 10½ games ahead of St. Louis before play on Aug. 26.

"It’s kind of fed us here the last few days, 120 years of baseball and this is one of those historic runs to tie," Cardinals manager Tony La Russa said.

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.

This much was certain: The Yankees will host an AL playoff opener on Friday night, the Philadelphia Phillies will be home for Game 1 in the NL 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.

"We don’t feel like we have anything to lose. We’ve had a great run," Tampa Bay’s Ben Zobrist said. "We’re hoping to cap it with a playoff berth."

Boston stranded the potential tying run at second base in the ninth, holding on for an 8-7 win at Baltimore on Tuesday night. The Red Sox haven’t won consecutive games since sweeping a doubleheader against Oakland on Aug. 27.

Looking for a sign of serendipity, Red Sox Nation? Rookie Ryan Lavarnway, the Yale thinker who never played a big league game before August, started because of injuries to catchers Jarrod Saltalamacchia and Jason Varitek and hit a three-run homer and a solo shot.

"Everybody’s been watching the scoreboard and knowing that we need to win tonight so we can come back tomorrow and fight through it again," Boston star David Ortiz said. "I hope if I’m still here next year we can make it easier. We’re playing like this is a playoff already."

At Tropicana Field, the Rays turned a 5-4-3 triple play to beat the Yankees, only the third in franchise history.

"Everybody’s thirsty for offense, and we’d like to score more," Rays manager Joe Maddon said. "But we’re built around pitching and defense."

In the NL, Atlanta lost to the best-in-the-majors Phillies on the next-to-the-last-night while St. Louis overcame a five-run deficit to win at worst-in-the-big-leagues Houston. The scheduled finales had the Braves starting about an hour before the Astros.

At Arizona, Ryan Roberts’ grand slam capped a six-run 10th for a 7-6 win over the Los Angeles Dodgers on Tuesday. The D-backs became the first team to overcome a five-run deficit in extras and win since Pittsburgh against the Chicago Cubs on April 21, 1991, according to STATS LLC.

Roberts channeled his manager, pointing at the Arizona dugout and pumping his fist over and over to imitate Kirk Gibson’s famed home run trot after his game-winning shot in the 1988 World Series.

"That was unbelievable," Roberts said. "I’ve never been a part of something like that. Everything on this team blows my mind."