Shields dominated the Royals before Buck's hit started a two-run inning. Pinch-runner Ryan Freel advanced all the way to third when catcher Dioner Navarro made an errant throw to second on Alex Gordon's fielder's choice, and Maier drove him in with an infield single.
Gordon stole home later in the eighth when Maier got involved in a rundown, and suddenly Shields found himself in a 2-0 hole.
"He was very good," Royals manager Trey Hillman said. "The crack was more defensive letdown than it was the fact that we were knocking him around the ballpark. I was glad John broke that up and then, obviously, we caught a couple of breaks."
Hillman left the team after his postgame media session to tend to a personal matter.
Brian Bannister (7-7) yielded five hits and struck out seven over seven scoreless innings, giving the Royals their first win in nine games against Tampa Bay this season. Joakim Soria, who surrendered a homer to Ben Zobrist in the ninth, pitched the final two innings for his 18th save.
• Royals: Ponson designated for assignment
"If a guy takes a no-hitter into the eighth and you still beat him that day, then it's a good team effort," Bannister said. "We haven't beaten this team at all this year, and so to win it that way was extra special."
"I know he can run and Longoria hit one right at me," Maier said. "He hits it anywhere else, I have no chance at him."
Shields (6-8) wound up yielding two runs and two hits in 7 1/3 innings, dropping to 0-3 in eight starts since beating New York Mets ace Johan Santana on June 20. Shields struck out six and walked four.
"What are you going to do?" Shields said. "I went out there and pitched my best game and came up short. You move forward, that's all I can do. I pitched well enough to win and Bannister pitched better."
There has never been a no-hitter in 940 regular-season games at Tropicana Field. The Rays have not thrown a no-hitter in their 1,884 regular-season games overall.
"I wasn't really thinking about the no-hitter," said Shields, who is 5-1 against the Royals. "I wasn't. All I wanted to do is shut them out, give this team a chance to win and I didn't get the job done. It would have been nice, but we lost the game."
Shields allowed just one baserunner -- a two-out walk to Yuniesky Betancourt with two out in the third -- through five innings.
The Rays put runners on second and third with one out in the second but Bannister struck out Navarro and induced Jason Bartlett to pop up to end the inning.
"I knew he had a no-hitter," Rays manager Joe Maddon said. "But it's 0-0, let's go. Let's get some points on the board. We made too many mistakes to win that game."
- Gordon is the first Royals player to steal home since Mendy Lopez on May 31, 2003.
- Kansas City designated RHP Sidney Ponson for assignment and plan to bring up RHP Kyle Davies from Triple-A Omaha to start Wednesday's game against Seattle.
- Royals RHP Gil Meche, out since July 12 with a lower back strain, had his rehab start for Class A Wilmington rained out.
- Tampa Bay OF Fernandez Perez (left wrist surgery) is getting close to starting a rehab assignment.
- Royals OF Mark Teahen (lower back tightness) was held out of the starting lineup. He popped out as a pinch hitter in the eighth.