The decisive blow was Perez's solo shot in the eighth against Brad Hand that followed Hosmer's game-tying two-run homer and put the Royals on top after trailing for most of the game.
"It means a lot," Perez said of the milestone. "Thank God for the opportunity and for the team. Enjoy the moment. It's a great feeling. One hundred homers, that's pretty good."
Kansas City batted around in the inning and scored nine runs against the San Diego bullpen. It was the fourth time the Royals have had back-to-back home runs this season.
"[Hand] has had a great year, and he has really pitched off that slider all year well," Hosmer said. "That's the benefit of hitting behind Lorenzo Cain. Any time he gets on first, he's a baserunning threat to steal. After I got the first slider, I knew there was a pretty good chance I'm gonna get a fastball. It might be the only one I got, so I just wanted to be on time and make sure I didn't miss it."
One day after becoming the franchise leader for home runs as a catcher, Perez also is the first batter to homer against Hand's slider, which had essentially been untouchable thus far this season. Opponents had been 4-for-61 against Hand's best pitch coming into Perez's at-bat.
"I was just looking for a good pitch to hit, and he left it up a little bit, and I was able to get enough to get it out," Perez said. "It was a good feeling."
For Perez and Hosmer, homering in the same game at Petco Park had a familiar feeling, as the two did so in the 2016 All-Star Game for the winning American League team.
"It's a fun place to play," Hosmer said. "Obviously, the weather here doesn't get any better, and it's a beautiful field, good atmosphere. I've had some great moments here, and I don't know what it is, but I definitely enjoy when the San Diego trip is on the schedule."
Cain hit a grand slam in the eighth -- his second homer of the game -- and one that put the game out of reach. The grand slam was the second of Cain's career, and Saturday also marked his fourth career game with two home runs.
"I was just looking for a fastball there," Cain said. "I didn't realize how hard he threw it, 97, but I was just looking for a good pitch to drive. That was the main goal there. It was a two-seamer, so I was able to get my hands inside and get it out. It was huge."
Alcides Escobar added a solo shot in the fifth that tied the game at 1.
"We had been swinging the bats OK, we just had some missed opportunities," Royals manager Ned Yost said. "Once we got the lead, our bullpen was thin, it was how are we going to protect this lead? And then we just kept tacking on, tacking on."
Ian Kennedy allowed four runs over six innings against his former team but did not factor in the decision.
"I thought he threw the ball great," Yost said. "All in all, his command was much better, and he gave us what we needed with six innings. I thought he was really good."
Tim Powers is a contributor to MLB.com and covered the Royals on Saturday.