"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
This weekend's series in Arlington, Texas, is a homecoming for Colorado Rockies shortstop Trevor Story, who grew up coming to Texas Rangers games and is playing in the stadium for the first time with the goal of doing some damage to the team he used...
The Toronto Blue Jays continue to wait for the return of third baseman Josh Donaldson from tightness in his left calf.
Having dipped into the minor leagues for four new players Friday, the Los Angeles Angels plan to do so again Saturday for their starting pitcher when they go for a second straight win against the Oakland Athletics.
Kyle Seager was asked before Thursday's series opener against the Boston Red Sox what it's like to face a knuckleball pitcher.
The third start of Madison Bumgarner's return to the San Francisco Giants' rotation after a broken finger will take the left-hander to a mound where he knows success.
Arizona left fielder David Peralta reworked his swing in the offseason, moving his hands lower and closer to his body with an eye toward getting the ball into the air. It is taking off.