"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.
Blackmon clears the bases, Murphy knocks in 4th run of inning
Charlie Blackmon clears the bases with a double to deep right field and Daniel Murphy adds on to the Rockies' 4-run fourth inning with a single to left in Colorado's win over Seattle.
Sources: Cardinals vs. Pirates on Monday postponed due to coronavirus
The Pirates won't fly to St. Louis on Sunday and their scheduled game against the Cardinals on Monday has been postponed, sources told ESPN's Jeff Passan on Saturday. Nine Cardinals players and seven staffers have tested positive for the coronavirus.
Padres activate Eric Hosmer from IL, option Abraham Almonte
San Diego Padres first baseman Eric Hosmer was activated from the injured list Saturday after missing 11 of the first 14 games with gastritis. He said he never received a precise diagnosis of the ailment.
Yankees' Giancarlo Stanton to have MRI on injured hamstring
Giancarlo Stanton will have an MRI on his hamstring, and manager Aaron Boone said "it does look like it's an IL situation" for the Yankees slugger.
Gerrit Cole fails to win 20th regular-season game in row as Yankees, Rays split doubleheader
Gerrit Cole, who had won his first three starts for the Yankees this season, struck out 10 and walked one in a no-decision Saturday, as the Yankees defeated the Rays to open a doubleheader.
Tigers hit 4 homers on game's first 11 pitches in rout of Pirates
Niko Goodrum, Miguel Cabrera, C.J. Cron and Jeimer Candelario all hit home runs in the first inning against Pittsburgh's Derek Holland as the Detroit Tigers drilled the Pirates 11-5 on Saturday.