ST. PETERSBURG, Fla. (AP) -- Down by nine games in early September, down by seven runs on the final day of the season.
And yet somehow, these Tampa Bay Rays made it to the playoffs.
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.
Pinch-hitter Dan Johnson saved the Rays with a two-out, two-strike solo home runs i the ninth that made it 7-all.
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, 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."
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.
Before the eighth, the Rays were limited to two hits - a pair of singles by Casey Kotchman - by a continuous stream of Yankees pitchers, beginning with a two-inning stint by rookie Dellin Betances .
George Kontos , Aaron Laffey , Phil Hughes , Raul Valdes , A.J. Burnett, Andrew Brackman , Logan, Ayala, Wade and Procter followed Betances, who made his first major league start.
The crowd lingered long after the game ended and celebrated by players, who returned from the clubhouse to spray fans behind the dugout and along the railings with champagne.
"That was one of the best days in baseball's history, probably," Teixeira said. "I really can't believe it. I think the fans should be excited."
NOTES: Rodriguez, scratched because of a sore right knee had his major league-record stretch of 13 straight seasons of 30 homers and 100 RBIs end. He had 16 home runs and drove in 62 runs over 99 games this year. ... Yankees GM Brian Cashman and other team officials held a second day of organizational meetings in preparation for the playoffs. Manager Joe Girardi said RH Freddy Garcia will start Game 3 of the ALDS behind LHP CC Sabathia and RHP Ivan Nova . ... The Rays were the only team in the AL that did not score 10 or more runs in a home game this season. The last time that happened was 1976 when the Angels and Orioles didn't do it.