KANSAS CITY, Mo. - David Phelps could only shake his head as he stood on the mound, kicking himself for an inning quickly gone wrong.

The Yankees had staged an unexpected rally -- unexpected given the way they've swung the bats lately -- from three runs down to tie the score in the sixth inning.

But Phelps walked the first two batters he faced in the bottom of the inning, then grooved a fastball that Salvador Perez hammered into the Royals' bullpen in left-center for a three-run homer. That left Phelps shaking his head in frustration.

There would be no second Yankees rally from a three-run deficit as they fell to the Royals, 8-4, in front of 26,991 at Kauffman Stadium.

Phelps, who had pitched decently since being inserted into the rotation May 5 because of various injuries to the pitching staff, allowed a season-worst seven runs and 10 hits in 52/3 innings.

Joe Girardi left himself open to second-guessing when he left Phelps in to face Perez, already 2-for-2 in the game.

After Perez's three-run blast, his sixth homer of the season, Lorenzo Cain tripled with none out and scored on Nori Aoki's two-out single to make it 7-3. Eric Hosmer's homer on an 0-and-2 pitch from Matt Daley gave the Royals an 8-3 lead in the seventh. Yangervis Solarte doubled and scored on Brian Roberts' grounder in the ninth to make it 8-4.

The Yankees (31-30) managed eight hits against four Royals pitchers.

Kansas City lefthander Danny Duffy, who came in 3-5 with a 3.05 ERA, shut out the Yankees for five innings before allowing three runs in the sixth. Duffy allowed five hits and three walks in 52/3 innings.

Phelps (1-4, 4.88) struck out two in a perfect first before running into trouble in the second.

Billy Butler and Alex Gordon led off the inning with doubles to make it 1-0 and Perez made it three straight hits with a blooper to left, putting runners at first and third. Cain then singled to make it 2-0.

After Mike Moustakas bunted into a forceout, which eliminated the lead runner at third, No. 9 hitter Alcides Escobar singled to make it 3-0. Phelps then retired Aoki and Omar Infante to end the 22-pitch inning.

The Yankees had two hits through the fifth inning, the frame in which they finally got their first runner in scoring position, which occurred without the benefit of a hit.

After Carlos Beltran fell to 0-for-9 since coming off the DL with a flyout to left, Solarte followed with a walk and advanced to second on a wild pitch. After the horribly slumping Alfonso Soriano, in a 6-for-40 skid coming in, struck out for the second time in the game, Roberts walked. John Ryan Murphy, who has played well when he's spelled Brian McCann this season, could not get Solarte in, fouling out to third to end the inning.

The Yankees got a pair of two-out hits an inning later to tie it.

Brett Gardner flew out to start the sixth and Derek Jeter, in a 6-for-32 slide, singled to right. After Jacoby Ellsbury flied to center, Mark Teixeira worked a walk. Beltran then collected his first hit since returning from the DL, ripping an RBI double into the leftfield corner to make it 3-1. Solarte sent a flare to short right-center that Cain just missed with a diving attempt, and the two-run single tied it at 3-3.