Only four Blue Jays reached base against Shields on two hits and two walks. Shields, who picked up his second straight win after struggling throughout most of July, struck out six batters.
"This is more like what we saw last year," manager Joe Maddon said of the righty. "Eight or nine innings, good pitch numbers. He didn't have to work extremely hard. I thought, actually, his last two innings might have been his best two innings."
Longoria, who is expected to be available on Wednesday, fared relatively well in his return from the disabled list, going 1-for-3 with a sacrifice fly.
"We talked in the dugout, not specifically about how he felt, but I thought he did really well tonight, physically also," Maddon said.
The four runs scored by the Rays were as many as they scored in their previous series against the Orioles. Longoria was one of eight Rays to have a hit on the night.
"Everything went well, I'm happy to say I got out of the game feeling great," Longoria said. "The win is the most important thing, and being able to contribute is just a bonus."
Speedy left fielder Desmond Jennings recorded a single and a double, going 2-for-3 with a pair of runs scored.
"I thought the offense was kinda perky tonight," Maddon said. "We didn't start out great, [Toronto starter J.A. Happ] struck out two in the first inning, but then we did OK after that. We moved the ball when we had to."
Tampa Bay put the first runs on the board in the bottom of the second. After Longoria grounded out to Happ in his first at-bat and Jeff Keppinger popped out, Ryan Roberts knocked a double just inside the right-field line. Sean Rodriguez followed with a bloop single to shallow right field to score Roberts.
In the second, the Rays set up Longoria by loading the bases. He cranked a ball to deep right-center field that was just shy of the fence, but far enough to allow Jennings to tag from third to make it 2-0.
On that same play, B.J. Upton advanced to third, and another sacrifice fly by Keppinger one batter later brought him in.
Colby Rasmus struck back the next inning, belting his 20th homer of the season off Shields to pull Toronto back to within two.
Jennings led off the fifth with a double and two batters later, Ben Zobrist doubled him home for a three-run advantage, which was a welcome sight for Shields.
"It seemed like the guys had a little different spark for some reason," Shields joked, alluding to Longoria's return. "I don't know if it's because Longoria is back or if everyone is happy that he's back, but we swung the bats well today."
Happ's day ended after Zobrist's double, and the lefty finished with four runs allowed on seven hits and a walk to go with five strikeouts.
"The results are the only things that matters, but I did feel better than probably the numbers indicate," said Happ, who was making his first start with Toronto. "I felt like I was making some good pitches. They used the whole field. ... I don't know how they got some of the hits they had, but they fell, and that's why it's sometimes frustrating."
Rays closer Fernando Rodney extended his scoreless innings streak to 22 and earned his 33rd save. Rodney surpassed Joe Borowski (21 in 2005) for the club record for scoreless frames by a reliever. Rodney is now one inning shy of Shields' overall club record (23 in 2011).