The Rays put up two runs in the fifth and another in the sixth inning off losing pitcher, Andy Pettitte, who was out-dueled by Tampa's Alex Cobb, who improved to 3-1 on the season, keeping the Yanks under wraps on three hits over 8 1/3 innings.
Cobb allowed just one baserunner from the third through eighth innings, threw 72 of 106 pitches for strikes, walked just one batter and fanned seven.
After allowing a one-out single in the ninth to Brett Gardner, Cobb handed the ball over to Fernando Rodney, who picked up his third save of the season, a night after blowing a chance in a 5-4 Yankees win.
The Rays improved their record to 10-11, but remain four game behind Boston in the East. The Yankees are 2 1/2 out; Baltimore holds second place, two games back of Boston.
Victory was anything but assured for the Mets, who trailed the Dodgers 3-1 in the sixth inning after Mett Kemp launched a two-run homer, his first of the season, but responded with a run in the bottom of the frame and tied the game at 3-all on David Wright's run-scoring single in the bottom of the ninth.
An inning later, Jordany Valdespin, who entered the game as a pinch-hitter in the eighth inning with two down and Marlon Byrd on third but grounded out to end the inning, reappeared with the bases loaded after staying in the game in center field.
This time, Valdespin did not disappoint, scorching his first home run of the season, a grand slam, walk-off finishing touch.
The Mets and Dodgers will settle up in the series finale, Thursday at 1:10 pm at Cit Field.