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.
Scarlett Johansson steps out with fiance after pregnancy reveal
Jessica Simpson shares three-way kiss with friends in photo