Michael Cuddyer had pulled the Twins to a 5-5 tie with a seventh-inning home run but the Rays struck for four runs in the eighth and three more in the ninth.
That handed the win to J.P. Howell (2-1), who struck out two in working the seventh inning. Alex Burnett (2-5) took the loss after being charged with four runs in 1 1/3 innings.
Longoria, who had three hits in the game, singled in Sam Fuld with a one-out single in the eighth and, after a run scored on a sacrifice bunt, came around on a home run by Sean Rodriguez that made the score 9-5. Longoria capped the scoring with a three-run drive that just made the left-field seats in the ninth.
Tampa Bay's scoring started with a two-run home run by Kelly Shoppach. Cuddyer tied the score with a two-run single the next inning but Tampa Bay added two runs in the fourth and a single run in the fifth.
Jim Thome got the Twins within 5-4 with a two-run single and Cuddyer tied the score in the seventh.
Swim Week Miami Beach 2014 [PHOTOS]