It was the Tigers' first sweep in Kansas City since 2014.
The Royals have lost six in a row and 11 of 12. Kansas City starter Brady Singer was removed after just three innings with tightness in his pitching shoulder.
''It popped up after his last start,'' Royals manager Mike Matheny said. ''We knew going into today that we were going to see how he was feeling and try to limit the work. We'll see how he responds from here, but we were just being cautious.''
Tarik Skubal (4-7) picked up the win. He allowed three runs on six hits in six innings, striking out seven against an all-righthanded lineup.
''The whole point as a starting pitcher is to give yourself a chance to continue the game,'' Detroit manager A.J. Hinch said. ''He's progressively gotten better at not having the big, explosive innings. He allowed us to slowly and surely get to their bullpen and come from behind and win.''
Skubal had a plan going in, and he stuck with it.
''I threw a lot more changeups than I did sliders,'' Skubal said. ''I knew the changeup would be a huge pitch for me against this lineup, just being able to work down and expand the zone.''
Michael Fulmer earned his fifth save in six chances.
Adalberto Mondesi hit a home run in his first at-bat since returning from the injured list. Salvador Perez also connected for the Royals, hitting his 17th of the season.
''(Mondesi) is unbelievable,'' Matheny said. ''The first time he steps in the box, he blasts it.''
Greg Holland (2-2) gave up three runs while getting just one out.
Holland issued a four-pitch walk to the first batter he faced, Niko Goodrum, in the seventh and Castro homered to make it 3-all.
''The hitting coach said after he gets two strikes he likes to throw the breaking pitch,'' Castro said. ''I was just trying to battle and let my abilities do the work.''
Holland left after a one-out single by Robbie Grossman, and reliever Scott Barlow gave up a single to Akil Baddoo and threw a wild pitch that let the go-ahead run score.
The Tigers' fifth run also scored on a wild pitch in the eighth and Detroit added a run in the ninth for a 6-3 lead.
Whit Merrifield hit an RBI double with two outs in the Royals ninth and Carlos Santana followed with a run-scoring single. Perez struck out to end the game.
Singer, who allowed one run on four hits, became the first Royals pitcher in five games not to surrender a run in the first inning when he worked around a one-out walk.
Mondesi hit a 445-foot homer in the second, giving the Royals their first lead in 46 innings.
Royals: SS Mondesi was activated from the 10-day IL on Tuesday, but he didn't appear in the game. He was in the starting lineup Wednesday, batting fifth. Mondesi has been out since May 31 with a left hamstring strain. Matheny said the plan was to activate Mondesi for Wednesday's game, but RHP Ronald Bolanos was placed on the IL opening a spot a day earlier. Mondesi was in the on-deck circle as a pinch-hitter when the final out was made.
Tigers: Open a four-game series against the Los Angeles Angels in Anaheim. RHP Matt Manning will make his major league debut. Manning was 1-3 with an 8.07 ERA in seven starts with Triple-A Toledo. The Tigers have not won a season series with the Angels since 2010.
Royals: After an off-day Thursday, Kansas City will continue the homestand with the first of three games against the Boston Red Sox on Friday night. RHP Jackson Kowar (0-2, 36.00 ERA) will try to find the form that made him one of the Royals' top prospects. Kowar has not lasted more than 1 1/3 innings in either of his starts, and he's allowed four earned runs in each.
More AP baseball: https://apnews.com/hub/MLB and https://twitter.com/AP-Sports
Copyright 2021 STATS LLC and Associated Press. Any commercial use or distribution without the express written consent of STATS LLC and Associated Press is strictly prohibited.