The Royals led 5-3 after four innings, but the Tigers fought back to tie it in the top of the fifth on a two-run single from Alex Avila.
Moustakas, however, responded in the bottom of the innings, smacking a 2-0 pitch from Justin Verlander into the Royals' bullpen for the decisive blow.
He finished 3-for-4 and Salvador Perez drove in three runs for Kansas City.
Greg Holland threw a scoreless ninth for his 24th save as the Royals clinched their three-game series with American League Central-leading Detroit.
Verlander (10-7) was tagged for six runs (five earned) on eight hits in a 5 2/3-inning effort.
Victor Martinez went 3-for-5 with an RBI for the Tigers.
Celebrity Breakups and divorces of 2014 [PHOTOS]