"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.
Calhoun's inside-the-park HR sparks D-backs past Astros 14-7
Kole Calhoun hit his first career inside-the-park homer with the help of a crazy bounce, David Peralta had four RBI and the Arizona Diamondbacks used a nine-run burst in the fourth inning to beat the Houston Astros 14-7 on Wednesday night.
A's top Rangers 6-4, win 5th straight behind Olson's 2 HRs
Matt Olson homered twice, Ramon Laureano also went deep and the Oakland Athletics rallied to beat the Texas Rangers 6-4 on Wednesday night.
Pederson cranks two homers vs. Padres
Joc Pederson hits a pair of two-run home runs in the Dodgers' win vs. the Padres.
Tatis tops off 418-foot homer with bat flip
Fernando Tatis Jr. flips his bat after crushing a two-run home run to left field.
Kole Calhoun sprints his way to an inside-the-park home run
Kole Calhoun drives a breaking ball to the wall that takes a hard bounce and Calhoun takes complete advantage with an inside-the-park home run.
Nick Ahmed drills his first dinger of the year
Nick Ahmed goes up high in the zone and sends his first home run of the season to left-center field to give the D-backs an 11-6 lead over the Astros.