"I don't get either one very often," Kotchman said.
Kotchman drove the first pitch from Blake Wood (5-1) over the centerfield fence. He also knocked in the other Tampa Bay run with a run-scoring single that tied it in the seventh.
"How about Casey?" Rays manager Joe Maddon said. "Those balls were properly struck. Kotch has been hitting like that all year. It's fun to watch."
Kotchman, who has seven multihit outings over his last 10 games, is hitting .341 this season. The greeting he received from the welcoming committee at the plate was a blur.
"Just kind of numb," he said.
It was Kotchman's first walk-off hit since he had an RBI single in the Los Angeles Angels' 2-1 victory over Texas on July 13, 2007. The first baseman has three homers over the last six games after going deep just four times in 93 games to start the season.
Rays closer Kyle Farnsworth (4-1) pitched a perfect ninth to earn the win.
Luke Hochevar allowed one run and five hits over seven innings for the Royals. The right-hander, who had won his previous three starts, had seven strikeouts and two walks.
Rays rookie Jeremy Hellickson, 3-0 in four starts during July, gave up one run and six hits in 7 1/3 innings. He struck out seven and walked three.
"It was a great game," Kansas City manager Ned Yost said. "There was outstanding pitching from both starters."
Tampa Bay tied it at 1 in the seventh when Ben Zobrist drew a one-out walk, went to second on a wild pitch and scored on Kotchman's single.
"Just happy to get the 'W," Kotchman said.
Eric Hosmer put the Royals ahead 1-0 on a first-inning RBI single. Alex Gordon, who had been hitless in his first 37 at-bats at Tropicana Field, hit a leadoff double and later scored on Hosmer's opposite-field hit to left.
Kansas City had a runner in scoring position in four of the first six innings, but went 2 for 10 in those situations. The Royals also failed to take advantage after getting two on with one out during the eighth.
Hochevar induced double-play grounders in both the fourth and fifth innings.
Kansas City center fielder Melky Cabrera was in the lineup after not starting Sunday's game because of a sprained left ankle. He went 2 for 4, including a double, and has 47 multihit games this year.
Tampa Bay RHP James Shields (10-9), Tuesday's scheduled starter, has seven complete games in 23 starts this season. "That was one of my main goals this year, throw some complete games," Shields said. "They're all in the first half so far, so I'm hoping to get a couple more in the second half." ... Kansas City LHP Jeff Francis (4-11) will be making his first career appearance at Tropicana Field in his start Tuesday. ... Tampa Bay C John Jaso (right oblique strain) is starting a rehab assignment with Triple-A Durham. ... Royals manager Ned Yost said C Matt Treanor (concussion) is making progress, but will likely be out at least a few more days.