The Rays won for the 23rd time in 28 games and moved a half game in front of Boston for first place in the American League East.
Tampa Bay roughed up CC Sabathia (9-9) for seven runs on nine hits in five innings. James Loney added four RBI for the Rays on a fifth-inning single and a three-run homer in the sixth.
Tampa Bay batted around in the second against Sabathia, scoring six runs on six hits in the inning.
Yunel Escobar doubled home the first run and then, after Jose Lobaton drew a walk, Escobar scored on a single by Sam Fuld.
Desmond Jennings put down a bunt and when catcher Austin Romaine threw the ball away Lobaton came in to score. Longoria followed with his two-run double and he came across with the final run of the inning on a single by Wil Myers.
Jeremy Hillickson (10-3) picked up the win after allowing a run on four hits in six innings.
Tampa Bay built a 10-1 lead through seven innings before the Yankees got to the Rays' bull pen. Five pitchers worked the final two innings for Tampa Bay before putting out the would-be New York rally.
Celebrity Couples of 2014 [PHOTOS]