The Boston Red Sox clinched the American League (AL) East at Yankee Stadium, but both teams were celebrating on Wednesday.
Mark Teixeira's two-out grand slam in the bottom of the ninth inning gave the Yankees a 5-3 victory to set off a celebration for the home team.
But the visitors would celebrate in their clubhouse because Boston had already clinched the division by virtue of Baltimore's come-from-behind 3-2 victory over the Toronto Blue Jays.
The Red Sox entered Wednesday's game with a magic number of one.
It is the eighth AL East title for the Red Sox, who did not let the disappointing loss stop them from popping the corks on champagne bottles in the clubhouse.
"I hope that's my last home run. I really do. That was incredible," said the 36-year-old Teixeira, who will retire after the Yankees' final game.
He struggled all year, with 15 home runs and a .205 batting average. It was the first regular-season walk-off home run of Teixeira's 14-year big league career.