NEW YORK -AP- Mark Teixeira hit a game-winning grand slam with two outs in the ninth inning, and the New York Yankees staved off playoff elimination at the last possible moment with a 5-3 victory over the Boston Red Sox on Wednesday night.Boston clinched the AL East title nearly 30 minutes before Teixeira connected, thanks to Toronto's 3-2 loss against Baltimore. But a five-run comeback by New York in the ninth prevented its longtime rival from celebrating on the Yankee Stadium field. The victory by the Orioles put the Yankees on the brink of wild-card elimination following a surprising charge late this season. New York had only one infield hit and trailed 3-0 heading into the ninth, with Red Sox closer Craig Kimbrel on his way in from the bullpen.Kimbrel, however, gave up a leadoff single to Brett Gardner and issued three straight walks, the last forcing in a run.Red Sox manager John Farrell lifted Kimbrel (2-5) for Joe Kelly, who struck out Starlin Castro and retired Didi Gregorius on a foul popup. With the Yankees down to their last out, Teixeira, planning to retire after this season, launched a 99 mph fastball on an 0-1 count into the New York bullpen in right-center.Yankees relievers raised their arms and Teixeira puffed his cheeks and spread his arms wide as he rounded first base. The 36-year-old, in his 14th big league season, tossed his helmet away and happy New York players poured out of the dugout to swarm him at home plate."I'm going to take away a lot of memories. This will be one of the best," Teixeira said.Meanwhile, the Red Sox walked back to their bench and quietly cleared out of the dugout, an awkward way to celebrate their second division crown in four years.New York ensured its 24th consecutive season with a winning record. Teixeira hit the Yankees' first game-ending grand slam since Alex Rodriguez on April 7, 2007.James Pazos (1-0) was the winner.