The teams combined for six home runs, two of them from Longoria. He hit a two-run shot during a three-run first inning and Upton contributed a three-run blast in the second.
Longoria's second homer came in the ninth inning as part of a 16-hit attack that brought an end to the Rays' four-game losing streak. Elliot Johnson added a solo shot in the fifth for the Rays.
Jake McGee (5-2) got the win with a perfect inning of relief after Alex Cobb was unable to make it out of the fifth. Cobb, who had won his other four starts in August, gave up four runs on eight hits in 4 2/3.
Matt Harrison (15-8) surrendered seven runs on 12 hits over 5 1/3 to suffer the loss. The Rangers lost for only the second time in eight games.
Celebrity Families of 2014 [PHOTOS]