Curtis Granderson led off the ninth with a single off Alex Torres (0-1), stole second and went to third on a groundout by Robinson Kano. Nick Swisher was intentionally walked and Andruw Jones coaxed an unintentional walk from Torres to load the bases.
Martin then worked another base on balls, plating Granderson with the eventual winning run for the Yankees, who remained two games behind the first-place Boston Red Sox in the American League East.
New York trailed 4-2 in the eighth but tied it on a Brett Gardner single and Eduardo Nunez's RBI groundout.
David Robertson (3-0) was credited with the win and Mariano Rivera racked up his 24th save with a 1-2-3 ninth in New York's victory.
Rays starter Alex Cobb held the Yanks to one earned run on three hits over six innings.
Evan Longoria contributed a two-run double for the Rays.
The game was delayed in the top of the fifth after lightning struck Tropicana Field, affecting a bank of lights. The contest resumed after a 17-minute delay.
Notable deaths of 2014 [PHOTOS]
UPI Sports Results for September 19, 2014