Facing Sergio Santos (0-3), who was promoted from Triple-A Buffalo earlier in the day, Ben Zobrist walked to begin the 10th and went to third on Logan Forsythe's ground-rule double. Longoria followed with a groundball single to left, scoring Zobrist. But Melky Cabrera threw out Forsythe at the plate, with the call confirmed by video review.
Jake McGee (4-1) worked two innings for the win and Brad Boxberger finished for his second save in five chances as the Rays won for the eighth time in 11 road games. They have won nine of their past 10 series away from home.
Toronto took advantage of an error and an infield single to put runners at the corners with none out in the bottom half, but Jose Reyes and Cabrera popped out before Boxberger ended it by fanning Nolan Reimold.
Tampa Bay opened the scoring in the first when Zobrist doubled and scored on Longoria's fielder's choice.
It stayed that way until the seventh, when Toronto broke through against Rays right-hander Chris Archer. Juan Francisco's sacrifice fly got Toronto on the board.
Rays manager Joe Maddon, who protested Saturday's game over the timing of a replay challenge by Blue Jays manager John Gibbons, was booed when he came out for a successful challenge on a fielder's choice first base in the fifth.
Maddon was booed again when he came out but declined to challenge a call at second base in the seventh, and tipped his cap to the crowd of 38,869 as he walked back to the first base dugout.
Blue Jays outfielder Jose Bautista went 0 for 3 and was ejected by home plate umpire Bill Welke for arguing after being called out on strikes in the sixth. Bautista, who is hitless in 11 at-bats, failed to reach base in three consecutive games for the first time since April 9-11, 2012. Reimold replaced Bautista.
It was the fifth ejection of the season for Toronto but the first for a Blue Jays player.
Rays: OF David DeJesus (broken left hand) went 1 for 2 with two walks and a stolen base in a seven-inning stint with Class-A Charlotte on Saturday night, while C Ryan Hanigan (left oblique) went 0 for 4 as the DH.
Rays: Tampa Bay begins a four-game series at AL East-leading Baltimore on Monday, with RH Jake Odorizzi facing Orioles RH Chris Tillman (10-5). Odorizzi is 4-0 with a 2.45 ERA in his past five road starts.