Joyce's seventh-inning line-drive homer over the left-field fence with B.J. Upton and Evan Longoria aboard erased a 3-2 deficit and lifted the Rays to a victory in their battle with the Boston Red Sox for the final post-season slot.
The Rays and Red Sox both won Tuesday, leaving Wednesday's final games of the regular season to decide who will reach the playoffs. Should both teams win or both lose Wednesday, a one-game tie-breaker would be played Thursday in St. Petersburg.
Joyce's blast off former Ray Rafael Soriano (2-3) came after the Yankees had taken the lead in the sixth. Tampa Bay escaped further damage when Yankees catcher Russell Martin grounded into a triple play -- the third in Rays club history.
Ben Zobrist went 2-for-4 with a with a two-run shot in the victory, which went to Jake McGee (4-2) after tossing a scoreless top of the seventh for Tampa Bay.
Martin socked a solo homer for AL East champion New York.