The Tampa Bay Rays clinched the AL wild card with a stunning rally Wednesday night, overcoming a late seven-run deficit and then beating the New York Yankees 8-7 on Evan Longoria's home run in the 12th inning.
The Rays' win came four minutes after Boston blew a one-run lead in the ninth at Baltimore and lost 4-3, causing a roar at Tropicana Field.
The Red Sox, who held a nine-game lead over the Rays in early September, and Tampa Bay began the final day of the regular season tied for the wild card.
Longoria hit a three-run homer in the eighth that capped a six-run burst. Pinch-hitter Dan Johnson's two-out, two-strike solo homer in the ninth tied it for Tampa Bay.
Longoria won it with a one-out shot barely inside the left-field foul pole, finishing the comeback from a 7-0 margin.
Tampa Bay will open its best-of-five playoff matchup at Texas on Friday. The Yankees will host Detroit in Game 1 Friday night.
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, and Johnson hit his tying shot off Cory Wade.
The Yankees pulled their regulars throughout the game and finished with a lineup that looked more like a Triple-A team.
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 back.
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, a crowd of 29,518 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.