Brett Gardner drove in three runs for the Yankees, two on a sharp infield single in the 11th that made it 8-5.
But the Royals, who tied the score in each of the previous four innings, once again refused to go down easily. They got a two-out RBI single from pinch-hitter Edward Olivares and brought the potential winning run to the plate before Carlos Santana grounded out to end a game that took 4 hours, 52 minutes.
“I’m just proud that, on a scorching-hot night, they just kept coming,” Yankees manager Aaron Boone said.
Wandy Peralta earned his third major-league save — the first two came with San Francisco this season.
Luke Voit, activated from the injured list Sunday, snapped a scoreless tie with an RBI single in the seventh and hit a tiebreaking homer in the ninth for New York. Aaron Judge had a run-scoring single in the eighth to make it 2-1.
“That was a grind,” Voit said, “but it was the definition of a team win. Everybody on the lineup card got the job done. Obviously, we had some ups and downs in the game, but we kept fighting back.”
Kansas City became the first team since 1900 to erase a deficit in the seventh, eighth, ninth and 10th innings of a game, according to STATS.
“I will not tire of talking about how hard these guys play the game and how great of a job they do fighting back all the time,” manager Mike Matheny said. “It’s unique, and the sign of professionals. Unfortunately, we got too big of a gap there in that last (inning).”
The Yankees got single runs in the seventh, eighth and ninth, but the Royals kept answering. Ryan O’Hearn‘s sacrifice fly in the seventh, Andrew Benintendi‘s single in the eighth and Nicky Lopez‘s single in the ninth each tied the score.
Giancarlo Stanton‘s 122 mph double-play grounder in the first inning matched his own mark for the fastest exit velocity of a ball put in play in the StatCast era.
Neither starter got a decision. Kansas City’s Carlos Hernandez allowed one run and five hits in 6 2/3 innings. He walked one and struck out three. Jameson Taillon gave up an unearned run and four hits in six-plus innings. He struck out four and walked two.
Play was delayed in the top of the fourth when plate umpire Brian Knight left the game. Pat Hoberg, who had been at third base, moved behind the plate. No reason was given for Knight’s departure.
The Associated Press contributed to this report.