Duffy struck out a season-high 10 over seven scoreless innings. He gave up only three singles -- one was a bunt -- and threw 69 of 108 pitches for strikes.
Duffy (3-3) had been 0-3 with two no-decisions in his previous five starts.
Moustakas hit his team-leading 10th home run with Drew Butera and Alcides Escobar aboard in the fifth off rookie Jordan Montgomery (2-3). It was just Moustakas' second homer off a left-hander this season.
Mike Minor pitched a scoreless eighth, his sixth straight scoreless outing.
New York (24-14) took two of three from the Royals and remain 1 1/2 games in front of the Baltimore Orioles for first-place in the American League East. The Royals (17-23) went 7-8 at home in playing 15 of their past 19 games at Kauffman Stadium.
Kansas City took advantage of a double play that wasn't turned to score a pair of runs in the second inning.
Eric Hosmer began the inning with a walk. After Salvador Perez flied out to right, Montgomery walked Jorge Bonifacio. Jorge Soler hit what should have been an inning-ending, double-play grounder with Bonifacio out at second, but first baseman Chris Carter dropped the relay throw.
Whit Merrifield won the battle of South Carolina alums with a run-producing single to center off Montgomery. Butera singled home Soler with the second run of the inning.
In the fifth, Merrifield reached on a bunt single to lead off the inning but was out on Butera's fielder's choice grounder. Escobar drew a walk for only the fifth time this season. Moustakas homered on Montgomery's next pitch into the Yankees' bullpen.
Montgomery was replaced after five innings, having allowed five runs on four hits with three walks and four strikeouts.
Duffy struck out the side on 12 pitches in the first.
NOTES: CF Lorenzo Cain, who left in the fifth inning Wednesday, was back in the Royals' lineup. He 0-for-4. ... Yankees OF Brett Gardner was not in the lineup, but he flied out as a pinch hitter to end the game. ... Royals RHP Ian Kennedy will in all likelihood come off the disabled list Saturday and start at Minnesota. He has been out since May 5 due to a right hamstring strain. ... The Yankees open a series Friday in Tampa Bay with RHP Luis Severino starting. The Rays will counter with RHP Erasmo Ramirez. ... The Royals open a 10-game trip Friday in Minnesota, starting RHP Nathan Karns. The Twins will start LHP Hector Santiago for the opener.