Evan Longoria homered to lead off the 12th inning and the Tampa Bay Rays beat the New York Yankees 8-7 to take the AL wild card.
The Boston Red Sox lost 4-3 to the Baltimore Orioles, who scored twice with two outs in the ninth. Wednesday's finishes left the Rays one game ahead of Boston.
Tampa Bay, which faced a nine-game wild-card deficit in early September, trailed 7-0 in the eighth Wednesday. Longoria hit a three-run homer to highlight a six-run eighth.
In the ninth, pinch-hitter Dan Johnson hit a two-out, two-strike homer off Cory Wade, who started the year in the Tampa Bay organization. Wade was at Triple-A Durham -- where Johnson spent much of the season -- before opting out of his contract in June.