ST. PETERSBURG -- James Shields gutted one out Wednesday night and finished with a masterpiece.

After the Tigers retired the Devil Rays in the bottom of the eighth, a loyal Tropicana Field crowd of 12,435 stood and cheered when Shields popped out of the dugout, took his usual giddy-up hop and trotted to the mound to try to complete what he started.

"Yeah I did [notice the standing ovation]," Shields said. "When you get our fans doing that, that's something special; when you get the AL champs coming into town, normally we get some other fans in town. When I went out there it was a great feeling. It pretty much got me through the inning."

Shields retired Neifi Perez and Ivan Rodriguez on fly outs before striking out Marcus Thames to end the game. The Rays right-hander pumped his fist and a roar from appreciative Rays fans followed for the effort, not only from Shields, but for the rest of the Rays players in the 5-3 win.

Nobody could have foreseen the ending after the way the game began.

Shields survived a three-run first inning in which the Tigers squared up on everything he threw across the plate. Unflustered, Shields made the necessary adjustments and went back to work.

"I made a few adjustments with a few hitters after the first inning," Shields said. "I mean the first inning, they were swinging at the first pitch and I couldn't really make adjustments because they were swinging so early. That team over there is probably the best hitting team in the league, one of the best at least. And you've got to make adjustments and it went well."

Rays manager Joe Maddon had a funny feeling after watching Shields survive the first.

"I even leaned over to [pitching coach Jim Hickey] and said I've seen Tim Belcher do this in the first inning and have a complete game," Maddon said. "Shields has got great makeup. They were going to attack early. Whenever you've got a pitcher with a good other pitch, you want to attack him early. Shields is pitching really well right now."

Yes, he is pitching really well, which might be the understatement of the season for the Rays.

From the start of the second inning through the end of the game, Shields faced just 26 hitters, walking one and allowing two hits.

"He's aggressive, he's got all the pitches, he's the real deal," Tigers manager Jim Leyland said.

In completing his second career complete game (the first of a nine-inning variety; he was credited with an eight-inning complete game Aug. 9 at Seattle), Shields moved to 4-0 on the season, won his fourth straight decision and gave the team seven-plus innings in his eighth straight start. Along the way, Shields has endured blown leads after he left the game and a lack of run support on multiple occasions that would have ensured more victories. That background made Wednesday night's win all the more special, particularly to Shields' teammates.

"The guy's determined to keep us in ballgames and that's the way he's been all year," Rays second baseman B.J. Upton said. "He's pitched a lot of good games. And for him to start off behind and throw a complete game like that, it's great."

While Shields stopped the Tigers from scoring, his teammates worked hard to generate some offense.

Jorge Cantu doubled home Akinori Iwamura in the second to cut the Tigers' lead to 3-1. Elijah Dukes then homered to lead off the fifth and Upton followed with a single. He moved to third on an errant pickoff attempt by Tigers starter Nate Robertson and scored on Carl Crawford's single up the middle to tie the score at 3.

Brendan Harris hit a solo home run off Robertson in the sixth to put the Rays up 4-3 and Upton added an RBI double -- after having a heated discussion with home plate umpire Jeff Nelson about his right to call timeout -- to push the lead to 5-3.

"When you give up three runs in the first inning, it's tough to come back," Shields said. "I never would have thought I would have thrown a complete game. But I give my hitters a lot of credit. I kept them in the ballgame and they scored a lot of runs for us."