Shields threw eight strong innings, Longoria drove in a run in his return from an injury, and the Rays beat the Toronto Blue Jays 4-1 on Tuesday night.
"I stayed aggressive," Shields said. "I think I've turned the corner. Hopefully I get on a little roll here."
Shields (10-7) allowed one run and two hits. The right-hander was coming off a three-hit shutout last Tuesday at Oakland.
Longoria rejoined the Rays after missing 85 games because of a partially torn left hamstring. He went 1 for 3 with a sacrifice fly as the designated hitter.
"It's weird going into a game just trying to make it out healthy," Longoria said. "Sometimes it's little things that are important, and today was a huge stepping stone. There was nothing about today that was negative. No setbacks, I felt great."
Fernando Rodney pitched the ninth for his 33rd save and completed the three-hitter. The closer set a team record for relievers -- breaking the mark set by Joe Borowski (21) in 2005 -- by extending his shutout streak to 22 consecutive innings.
Longoria got a standing ovation before his first at-bat in the second, when left-hander J.A. Happ (0-1) reached behind his legs to glove a grounder and then threw out the three-time All-Star.
Longoria made it 2-0 on a bases-loaded sacrifice fly in the third, an opposite-field drive caught at the wall by right fielder Moises Sierra. Jeff Keppinger extended the lead to 3-0 on another sacrifice fly later in the inning.
After striking out in the fifth, Longoria ended his night with a line-drive single to center in the eighth.
"I'm just as happy as anyone else that Longo is back," Shields said. "Just to see him back in the clubhouse and see him out on the field. He's the leader in this clubhouse, that's what it comes down to."
Shields struck out six, walked one and hit a batter.
"Shields really held us down," Blue Jays manager John Farrell said.
The Rays stopped a 22-inning scoreless stretch and took a 1-0 lead in the second as Ryan Roberts -- mired in a 3-for-32 slide -- hit a two-out pop fly double down the right-field line and scored on Sean Rodriguez's single.
Colby Rasmus hit his 20th homer, a solo shot in the fourth, that got Toronto within 3-1. Rasmus, who had missed the previous two games because of tightness in his right groin, singled in the ninth.
Tampa Bay went ahead 4-1 in the fifth on Ben Zobrist's RBI double. Zobrist had left Sunday's game with upper back spasms.
Happ, making his first start with the Blue Jays, gave up four runs and seven hits in 4 1/3 innings. He had made four relief appearances since being acquired from Houston on July 20.
"The result is the only thing that matters, but I did feel better than, probably, the numbers indicate," Happ said. "I felt like I was making some good pitches. They used the whole field and they were falling for them, and weren't falling for us. A frustrating one for sure."
Happ's previous start, while with the Astros, came on July 16. He threw 6 1/3 innings in a 2-0 win over San Diego.
Farrell said OF Jose Bautista, out since July 17 with left wrist inflammation, still has some soreness on a small area of the hand and will undergo an MRI. ... Blue Jays INF Brett Lawrie missed his third straight game due to rib cage tightness. ... Tampa Bay DH Luke Scott (oblique) ran the bases and took batting practice. ... Toronto RHPs Drew Hutchison and Dustin McGowan are both scheduled to have surgery Thursday. Hutchison will have elbow ligament surgery, while McGowan is scheduled for arthroscopic surgery to evaluate the right shoulder joint.