"You kind of dream about doing things like that and they don't happen very often," Upton said. "And to do that against a Ranger ballclub that pitches pretty well is a great feeling."
Upton hit solo homers in the first, fourth and sixth innings. He struck out in second, and received a standing ovation before hitting a broken-bat grounder to third in the eighth.
"They were talking to me about (hitting a fourth home run) in the dugout, but I wasn't trying to do that," Upton said. "I broke that bat and I wasn't too happy about that."
"He's player of the game as far as I'm concerned," Shields said. "Three home runs in one game ... it's probably the first time he's ever done that in a game. He's really locked in right now. He's one of the guys that, I told everyone this year, he's my pick to click and he's really showing it down the stretch here."
Tampa Bay took two of three in the weekend series against the AL West leaders. The first two games went extra innings. The Rays trail the AL East-leading New York Yankees by two games.
"James Shields was on," Texas manager Ron Washington said. "He was really good. If you look at the game, you've got to give credit to James Shields. When a guy like that is pitching like that, it makes you look like you're lethargic."
Texas completed a 10-game road trip at 6-4.
"Today definitely wasn't our day," Rangers designated hitter Michael Young said.
Shields struck out eight in his second complete-game shutout this year. The other came in a 3-0 win over Oakland on July 31.
"Shieldsy was outstanding today and that was as good as he's thrown all year, and BJ's performance ... put those together and they were fun to watch," Rays manager Joe Maddon said.
Upton had a fourth-inning shot off Martin Perez that extended the lead to 5-0. He also hit his 21st homer this season against the left-handed reliever in the sixth.
Oswalt, making his first start since Aug. 23, left after two innings because of right flexor muscle soreness near his elbow. The right-hander, who allowed four runs and six hits, took the place of 15-game winner Matt Harrison, who had his scheduled start pushed back from Sunday to Tuesday to allow for extra rest.
"I felt it on one pitch in the first, on my slider and it bit me a little bit," Oswalt said. "Couple days, it should be all right."
Tampa Bay went ahead 4-0 on Jose Molina's two-run homer during the second. It was his sixth homer this season and first since Aug. 17.
Tampa Bay LHP David Price (left shoulder soreness) will have a bullpen session on Tuesday. Maddon expects the 17-game winner to start either Friday or Saturday at the New York Yankees. ... Texas had won six straight series. ... Oswalt has given up 11 homers in 54 1/3 innings this season. ... Rays LF Desmond Jennings was out of the starting lineup for the second consecutive game because of lower back stiffness. He could return Tuesday. ... LHP Miguel De Los Santos, placed on waivers by Texas on Thursday, was claimed by Milwaukee. ... Texas struck out 35 times in the series. ... Both teams are off Monday. ... Tampa Bay plays at Baltimore, while Texas hosts Cleveland on Tuesday.