PHOENIX -- Troy Glaus ended his team's struggles -- and his own -- with one swing.
His drive into the left-field seats against Mike MacDougal (2-3) came after the Arizona bullpen blew an eight-run lead in the last two innings.
"That's not exactly how we draw it up, but at the end of the day we got the win," said Glaus, who hadn't homered in 51 at-bats since May 25. "I'm trying to get a pitch that I could drive, just so I could get on base. We're just trying to scratch across one at that point, but it worked out and we got the game over with."
The Diamondbacks led 11-2 after five and 11-3 after starter Russ Ortiz's seven innings, but Kansas City scored six runs in the eighth and two in the ninth, taking advantage of seven of Arizona's season-high 10 walks.
Closer Brian Bruney (1-2) pitched a perfect 10th for the win.
"That's the biggest hit we've had this year," manager Bob Melvin said. "Because to have an 11-3 lead and they come back, that can deflate you a little bit."
Shawn Green drove in five runs -- three with a pair of towering home runs -- in his 28th multihomer game.
Green, who also had an RBI double and a sacrifice fly, broke out of a 4-for-22 slump when he doubled off Royals starter Zack Greinke in the first. He hit both homers off Greinke and a sacrifice fly against Mike Wood in the Diamondbacks' fourth-run fifth -- the last time they scored until the 10th.
It was Green's first multihomer game since Sept. 13 for Los Angeles against San Diego. He hadn't homered since May 6.
"I hadn't hit a home run in a while and I was just trying to get hits, do what I can until the power comes," he said.
Greinke allowed career highs of 15 hits and 11 runs in 4 1/3 innings. Arizona had a season-high 20 hits.
"If you ask my pitching coach, he'll say I've been leaving the ball up," Greinke said. "If you ask the guys on the team, they'll say I'm not throwing my best pitches. If you ask me, I'll say it's both."
Kelly Stinnett also homered for Arizona, which won its second straight after losing seven of eight against the New York Mets, Philadelphia and Minnesota.
Alex Cintron had his third four-hit game and drove in two runs. Luis Gonzalez also had two RBI, and Chad Tracy had a run-scoring double.
Ortiz gave up three runs on seven hits and three walks.
After he left, the Royals scored six runs on three hits and six walks in the eighth before Lance Cormier, the fourth Arizona reliever in the inning, got Ruben Gotay on a grounder for the third out.
Cormier also pitched the ninth, allowing David DeJesus' RBI fielder's choice and Matt Stairs' RBI single that tied it at 11.
Gotay, who drove in three runs, got Kansas City within 11-5 with a two-run homer off Edgar Gonzalez. Gonzalez was taken out after walking Shane Costa and John Buck, but Matt Herges walked his first batter, loading the bases, and Emil Brown hit into a fielder's choice for an RBI.
DeJesus followed with a two-run triple, cutting the deficit to 11-8. After Herges walked Stairs, Javier Lopez walked his first batter and then walked Mark Teahen to force in a run and make it 11-9 before Cormier entered.
"That's a tough loss," Royals manager Buddy Bell said. "We did a lot of bad stuff, and we did an awful lot of good stuff. It's just unfortunate it came down to the home run by Glaus, who's done it a lot in his career."
The highlight for Greinke was a home run in his fourth major league at-bat. Greinke, 0-for-2 last year as a rookie, cut Arizona's lead to 7-2 with his one-out shot in the fifth -- the eighth homer by a Royals pitcher, the first since Lance Clemens on Aug. 31, 1971, at Milwaukee.
Terrence Long and Gotay hit RBI doubles for the Royals.
Long's came in the first, but Arizona tagged Greinke for five hits -- four for extra bases -- in its half.
Craig Counsell led off with a single. Cintron tripled into the right-field corner, then scored on Gonzalez's double.
Green and Tracy added RBI doubles in the inning.
Green hit a 410-foot, opposite-field solo shot in the third, and pulled a pitch 421 feet into the right-field seats behind the swimming pool in right center in the fourth after a single by Glaus, who had three hits.
The Royals are 6-4 under Bell, who was hired May 31. ... After Greinke was pulled in the fifth, RHP Steve Stemle was announced in relief, but developed muscle spasms in the right side of his back during warmup pitches. Wood faced Gonzalez and Glaus, who both singled, and Green for his run-scoring fly. ... Tracy, who had two doubles, ended the third with an unassisted double play, doubling Teahen at first after catching a liner by Costa. ... Cintron's last four-hit game was on Sept. 28, 2003, against St. Louis.