Evan Longoria capped a startling comeback by hitting his second home run of the game, hooking a drive barely inside the left-field foul pole in the 12th inning Wednesday night and giving the Rays the AL wild-card spot with an 8-7 win over the New York Yankees.
Just as they overcame a big deficit in Wednesday's game, the Rays erased a sizable nine-game deficit in the AL wild-card race and passed the Boston Red Sox on the last day of the regular season.
Pinch-hitter Dan Johnson saved the Rays with a two-out, two-strike solo home runs in the ninth that made it 7-7.
Longoria connected shortly after midnight, four minutes after Boston blew a ninth-inning lead and lost at Baltimore 4-3. The Red Sox, who seemed to be running away from the Rays a few weeks ago with a nine-game lead, and Tampa Bay began the day tied for the final AL playoff spot.
"It's a good feeling knowing that one put us into the playoffs and not into a playoff game," Longoria said. "So I'm just thinking about, 'Wow, did this just really happen?' ... Man, when I saw it clear the fence it didn't seem real."
Boston became the first team to miss the post-season after leading by as many as nine games for a playoff spot entering September, according to the Elias Sports Bureau.
"We'll go down in history as one of the worst collapses in history, so it definitely doesn't feel good to be part of that," Red Sox left-fielder Carl Crawford said. "We had high expectations, and to fall short the way we did is definitely disappointing for us."
Elsewhere in the AL it was: Toronto 3 Chicago 2; Texas 3 Los Angeles 1; Detroit 5 Cleveland 4; Minnesota 1 Kansas City 0; and Oakland 2 Seattle 0.
At St. Petersburg, Fla., the crowd of 29,518 at Tropicana Field was mostly silent as the Rays trailed 7-0 going into the eighth. But Longoria's three-run homer finished a six-run burst in the eighth and Johnson, hitting only .108, tied it with a shot off Cory Wade.
The fans roared when the Red Sox loss was posted on the scorecard. Moments later, they erupted again when Longoria homered.
"It's a storybook finish," designated hitter Johnny Damon said. "Definitely gratifying."
Boston led by nine games on Sept. 4. If the Red Sox had held on to win, the teams would have met in a one-game playoff at Tropicana Field on Thursday.
Instead, the Rays will open the first round of the AL playoffs on Friday at Texas.
"It was a crazy night," Rays manager Joe Maddon said. "What happened out there goes beyond the imagination."
"I want to say this: The Yankees are true champions," he said. "They played us great. They made us work for every inch of it."
Longoria connected off Scott Proctor (0-3) to end it. Proctor was the Yankees' 11th pitcher of the game -- they did not use all-time career saves leader Mariano Rivera.
The AL East champion Yankees pulled their regulars throughout the game and finished with a lineup that looked more like a triple-A team.
"The emotion of the day was something you can't dream up when you look at the schedule," Yankees star Alex Rodriguez said. "Longoria had a magical night. They're very dangerous because they have good pitching."
Moments before Tampa Bay won, it looked as if Boston would instead be going to the playoffs.
The Orioles were down to their last strike in the ninth before scoring twice off Red Sox closer Jonathan Papelbon.
The Rays, meanwhile, escaped a first-and-third, no-out jam in the 12th. Longoria made the key play, fielding a grounder at third and making a snap tag to catch the runner diving back to the base.
"Weird. Just when you think you've see it all," Yankees captain Derek Jeter said. "It's one of those days. You have a team down seven runs in the eighth and Boston winning. It was very bizarre."
Mark Teixeira hit a grand slam off all-star David Price and a solo homer as the Yankees built their big lead. The Rays sputtered against a parade of New York pitchers, until the eighth. Longoria homered off Luis Ayala to pull Tampa Bay within a run.
Teixeira's second-inning slam put the Yankees ahead 5-0. His solo shot made it 6-0 and came simultaneously as Dustin Pedroia went deep for Boston to give the Red Sox a 3-2 lead in their game. The Rays began cutting into their deficit during a rain delay in Baltimore.
A night after Matt Joyce's three-run homer gave Tampa Bay a 5-3 victory that kept the wild-card race tied, the crowd didn't have much to cheer until the eighth when the Rays loaded the bases with no outs against Boone Logan.
Ayala replaced Logan and walked pinch hitter Sam Fuld to force in one run, then hit Sean Rodriguez with a pitch to force in another. B.J. Upton's sacrifice fly trimmed Tampa Bay's deficit to 7-3 before Longoria connected.
At Baltimore, the Orioles won it in the ninth against Boston closer Jonathan Papelbon (4-1), who struck out the first two batters before giving up a double to Chris Davis. Nolan Reimould followed with a double to score pinch-runner Kyle Hudson, and Robert Andino completed the comeback with a single to left that a sliding Crawford couldn't glove.
"I was just overthrowing the ball, not really focusing on location," Papelbon said. "I felt great. I felt great all year."
It was only his third blown save of the season and only defeat.
"I don't think is going to define me as a player. I don't think this is going to define this ballclub this year," Papelbon said, his voice breaking. "I don't know about everyone else in this clubhouse, but whatever doesn't kill you makes you stronger."
Jim Johnson (6-5) worked the ninth for Baltimore.
"To walk off, everybody wants to walk off," Andino said. "It's priceless man, you don't have any words for it. Just enjoy it, and there's no tomorrow, so next year."
The same can be said for Boston.
Dustin Pedroia homered for the Red Sox, who went through the entire month of September without winning consecutive games.
"I'm devastated. I'm heartbroken," Pedroia said. "To play hard for 161 games like we have and have it end like this. ... It should not have gone down to the last game of the season to decide if we were going to the post-season."
Blue Jays 3 White Sox 2
At Chicago, White Sox pitcher Chris Sale issued a pair of bases-loaded walks in the ninth inning as Toronto rallied for a win.
Rangers 3 Angels 1
ANAHEIM, Calif. (AP) -- Mike Napoli broke a tie in the ninth inning with his fourth homer in two games, and Texas finally clinched home-field advantage in the AL division series.
Tigers 5 Indians 4
At Detroit, Miguel Cabrera singled and doubled, wrapping up the American League batting title, and Jhonny Peralta hit a tiebreaking homer in the eighth for the Tigers.
Twins 1 Royals 0
At Minneapolis, Trevor Plouffe's RBI single with two outs in the ninth inning helped Minnesota stave off a 100-loss season.
Athletics 2 Mariners 0
At Seattle, Gio Gonzalez pitched eight innings of two-hit ball, leading Oakland to the victory.