Posada came off the bench to hit for Francisco Cervelli and golfed a 2-0 pitch from Dan Wheeler (2-3) 420 feet to straightaway center field, redeeming the Yankees after they had squandered a big lead.
Mariano Rivera made Posada's clout hold up, collecting his 30th save of the year in the bottom of the 10th, while David Robertson (3-4) collected the victory for tossing a scoreless ninth.
The victory allowed New York to wrest first place in the American League East from the Rays by a half-game and evened their three-game series at one win apiece.
Robinson Cano homered, went 3-for-4 and drove in three runs and Alex Rodriguez added a solo shot among his two hits for the Yanks.
Willie Aybar and Carlos Pena homered during a seven-run fifth inning that allowed Tampa Bay to erase a 6-0 deficit.