Pettitte (3-2) struck out 10 and allowed only two hits in a dominating performance that boosted the Yankees to within a half-game of the first-place Rays in the American League East.
The Yankees left-hander didn't allow a runner to reach third base.
Leading 2-0 in the fourth inning, New York loaded the bases with one out against James Shields (6-4) and Martin then sliced an 0-2 pitch over the right-field wall for a four-run shot.
The New York catcher finished the game 3-for-4.
Shields was tagged with the loss, surrendering seven runs (five earned) on seven hits in a five-inning effort for Tampa Bay.
Notable deaths of 2014 [PHOTOS]