NEW YORK (AP) — Salvador Perez hit a three-run homer off All-Star closer Clay Holmes in the ninth inning, and the Kansas City Royals beat the New York Yankees 8-6 to avoid being swept in the season series.

New York overcame a 4-0 deficit and took a 6-4 lead when Anthony Rizzo hit a three-run homer into the right field second deck in the seventh off Dylan Coleman, Rizzo’s 25th home run this season.

Hunter Dozier homered against Ron Marinaccio leading off the eighth, ending Marinaccio’s 19-inning scoreless streak and run of 56 consecutive batters without allowing a hit.