The game was tied 1-1 when Longoria hit his 13th homer of the season off Scott Baker (2-6). Baker gave up four runs overall on seven hits in 5 2/3 innings.
James Shields (4-4) worked seven innings for the win, giving up seven hits and two runs with five strikeouts. Randy Choate got the final out in the ninth to earn the first save of his career.
Carl Crawford added a solo homer for Tampa Bay and scored three times.
Longoria's home run came after B.J. Upton and Crawford had opened the inning with singles.
Copyright 2009 by United Press International.