Andy Pettitte and Gio Gonzalez matched each other with scoreless frames for the first five innings before the Yankees finally broke through with a run in the bottom of the six to take a 1-0 lead. But in the top of the seventh, Pettitte lost his rhythm and Alfredo Aceves was unable to bail him out as the A's score six times to take a five-run lead.
Pettitte pitched 6 1/3 innings, allowing four earned runs on five hits with seven strikeouts and one walk.
Gonzalez earned his second win of the year with 6 2/3 innings of two-hit baseball. He allowed one earned run, striking out six and walking three.
The Yankees staged a rally in the eighth inning with Derek Jeter hitting a two-run home run and Mark Teixeira cranking a solo shot, but that is where the comeback ended.
In the bottom of the ninth, A's closer Andrew Bailey walked Melky Cabrera and Johnny Damon to start the inning in what looked to be another walk-off win for the Yankees in the works. But Bailey settled down to get Jorge Posada to bounce into a double play and Jeter to fly out to center field to end the game.