NEW YORK, N.Y. –The Royals were were able to halt their five-game losing streak with an 8-6 victory over the Yankees.

Salavdor Perez came up big for the Royals, notching a three-run homer in the top half of the ninth-inning, giving the Royals the lead and the victory.

The Royals would strike first, gathering a 4-0 lead in the fifth, led by a Nick Pratto RBI single that brought in two-runs. The Yankees would respond immediately in the bottom half of the inning.

DJ LeMahieu would make it a 4-3 game after a two-run homer.

The Yankees would take their first lead of the game in the seventh after an Anthony Rizzo homer, but the back-and-forth affair would continue, as Hunter Dozier would belt a solo-homer in the eighth, followed by Salvy’s game-clinching home run in the ninth.

Zack Greinke got the start for the Royals, going five innings with three runs, three runs, three Ks and two walks.

Taylor Clarke (2-1) was credited the win.

The Royals will now travel to Chicago for a three-game series with the White-Sox. The first game will be Monday at 7:10 p.m. CT.