"After the first three or four, I was starting sitting on it," Moustakas said. "Finally, he ended up leaving one up, and I was able to get a good swing on it."
Abraham Almonte hit a grand slam in the sixth to give the Royals a 5-2 lead, but Detroit tied it with three runs in the bottom of the inning.
Kansas City took the lead again when Drew VerHagen (0-1) walked two batters in the seventh and Moustakas hit a drive to right off Farmer. It was the sixth pitch of the at-bat.
The Royals won for only the second time in 12 games, and Moustakas extended his hitting streak to 14.
Kevin McCarthy (1-0) became the first Kansas City reliever credited with a win this season, although that came after he let the lead slip away in the sixth. Brian Flynn pitched two scoreless innings of relief for the Royals, and Kelvin Herrera worked a perfect ninth for his fourth save.
Detroit starter Francisco Liriano took a no-hitter into the sixth before Whit Merrifield led off with a homer to left. With two on and one out, Alex Wilson came on in relief and walked his first batter to load the bases. Almonte followed with a drive to right for his second career grand slam .
"I came into a big spot and I didn't do my job," Wilson said. "There's nothing puzzling about it -- I made terrible pitches."
Royals starter Eric Skoglund walked the first two hitters of the bottom of the sixth, then was relieved by McCarthy. Nicholas Castellanos greeted him with an RBI single, and an error by left fielder Paulo Orlando left men at second and third. One out later, JaCoby Jones hit an RBI single, and James McCann added a sacrifice fly to make it 5-all.
"It is frustrating that Frankie gave us a chance and our hitters got us right back into the game, but our bullpen couldn't get the ball over the plate," Tigers manager Ron Gardenhire said. "We had some guys who weren't available today, so we were mixing and matching, but no matter who we bring in, we need them to throw the ball over the plate and get outs."
The Tigers took a 2-0 lead in the first on an RBI groundout by Miguel Cabrera and a run-scoring single by Castellanos.
Castellanos had three hits.
Almonte had a big ninth-inning hit in a win Friday night, then added three more hits Saturday. He wrapped up the series in impressive fashion with his grand slam.
"I've been feeling better every game, every at-bat," Almonte said. "I'm getting more confident, I'm seeing the ball better."
Although they finished on a sour note, the Tigers went 5-3 on their homestand, averaging 6.4 runs a game.
"We need to keep playing the way we played this week," leadoff hitter Leonys Martin said. "We're not going to win every game, but we will give ourselves a chance. That's all you do. Play 27 outs and make sure you have a chance."
Royals: C Salvador Perez (left knee sprain) caught seven innings and went 3 for 4 with a homer Saturday night on a rehab assignment with Triple-A Omaha. He went 1 for 3 as a DH on Sunday. ... OF Alex Gordon (left hip tear) went 1 for 2 with two walks Saturday and 1 for 3 on Sunday. "They're close," Kansas City manager Ned Yost said.
Both teams are off Monday. The Royals begin a two-game home series against Milwaukee on Tuesday night. Kansas City sends RHP Ian Kennedy (1-2) to the mound against RHP Zach Davies (1-2). Former Royals star Lorenzo Cain plays for the Brewers now after signing with Milwaukee in January.
More AP baseball: https://apnews.com/tag/MLBbaseball
Follow Noah Trister at www.Twitter.com/noahtrister
Buster's Buzz: Red Sox repeat? Four question marks facing the champs
From health to hangovers, Boston still must find a few answers in its quest for a second straight ring.
Yankees sign reliever who criticized Babe Ruth
Mike Golic finds it comical that the Yankees signed reliever Adam Ottavino who previously stated he would "strike out Babe Ruth every time."
Mariano Rivera, Lee Smith and what makes a Hall of Fame closer
One is a first-ballot lock. The other a last-chance inductee. Here's what Cooperstown's 2019 ninth-inning stars tell us about Hall standards for the position.
Red Sox manager Alex Cora may reconsider decision to visit White House
Red Sox manager Alex Cora, a Puerto Rico native who has been outspoken about its need for hurricane relief, indicated on Thursday that he may skip the World Series celebration at the White House over President Trump's policies toward the island.
Forget Babe Ruth, Yankees get the guy who could strike him out
Adding Adam Ottavino -- who boasted he'd whiff the Bambino "every time" -- gives the Bombers the best bullpen in the universe.
Could these 'mystery teams' be in on Manny Machado, Bryce Harper?
Are the Yankees set to swoop in on Manny after all? Who might be biding their time for Bryce? We look at some of the potential surprise suitors insiders are talking about.