Robinson Cano, Mark Teixeira, Brett Gardner and Eduardo Nunez also drove in runs for the second-place Yankees, who rallied from a 4-1 deficit to remain 1½ games behind the Boston Red Sox in the AL East standings.
Rookie left-hander Alex Torres (0-1) yielded the winning run in his major league debut after New York loaded the bases on Curtis Granderson's single, an intentional walk to Nick Swisher and another walk to Andruw Jones. Martin worked Torres to a full count, fouled off a pitch and then took ball four to push Granderson across the plate.
The Rays wasted a nice pitching performance by rookie Alex Cobb, who allowed two runs and three hits after being called up from the minors to make his sixth major league start.
The 23-year-old right-hander limited the Yankees to Robinson Cano's RBI grounder in the first and Mark Teixeira's run-scoring single in the fifth before turning over a 4-2 lead to a depleted bullpen.
Sunday night's 1-0, 16-inning loss to Boston left Tampa Bay manager Joe Maddon with limited options after Cobb departed. The Yankees tied it 4-all with two runs charged to reliever Cesar Ramos in the eighth, but wasted a chance to take the lead when Derek Jeter struck out with the potential go-ahead run at third base.
After going a combined 3 for 50 in the extra-innings loss to the Red Sox, the Rays scored three times and matched their hit total from the 5-hour, 44-minute marathon in the first inning alone against Yankees starter A.J. Burnett. Evan Longoria drove in the first two with a double and Burnett's throwing error permitted the third run to score.
Casey Kotchman's bases-loaded infield single made it 4-1 in the second.
Both Cobb and catcher Robinson Chirinos, who made his major league debut and doubled in his first at-bat, were recalled from Triple-A Durham earlier in the day.
Cobb gave up a run in the first without allowing the Yankees to get the ball out of the infield. Granderson stole second after reaching on a one-out, bunt single, took third on second baseman Sean Rodriguez's fielding error and scored when Cano grounded into a force play.
The Rays starter issued two-out walks to Brett Gardner in the second and Jorge Posada in the fourth, but New York didn't manage another hit until Teixeira's RBI single trimmed New York's deficit to 4-2. Moments later, a lightning strike caused a bank of lights along the first base line to lose power and play was stopped for 18 minutes.
Burnett allowed four runs and eight hits in 5 1-3 innings. The right-hander walked six, but the Rays didn't take full advantage and stranded 10 baserunners through the first six innings.
The Yankees wasted some good opportunities of their own, stranding runners in scoring position in the fifth and seventh. Cobb prevented further damage after Teixeira's RBI single when he got Cano to ground out to end the fifth, and Ramos preserved a two-run lead when he struck out Teixeira with runners at first and second to shut down the other threat.
Jeter went 1 for 5, moving ahead of Hall of Famer Al Kaline into 26th on the career hit with No. 3,008 on a seventh-inning single off Joel Peralta.
NOTES: To make room on the roster for Cobb, Chirinos and Torres, the Rays designated RHP Adam Russell for assignment and placed C Jose Lobaton (left knee sprain) and RHP Juan Cruz (right groin strain) on the 15-day disabled list. ... New York INF Ramiro Pena had an appendectomy on Monday and was placed on the DL. INF Brandon Laird was recalled from Triple-A Scranton/Wilkes-Barre. ... Yankees RHP Rafael Soriano (right elbow inflammation) and INF Eric Chavez (broken left foot) are scheduled to start minor league rehab assignments Tuesday night with Class-A Tampa. ... New York RHP Mark Prior has had his rehab program for a groin strain curtailed by back soreness.