Salvador Perez drove in three runs, including the go-ahead run in the bottom of the eighth, and the Kansas City Royals snapped a seven-game losing streak with a 6-4 win over the Washington Nationals.

With two outs in the eighth and with Craig Stammen (7-6) pitching for the Nationals, the Royals loaded the bases on two walks and an infield single.

Perez, who also had a two-run home run in the first, hit a grounder towards Ian Desmond, who bobbled the catch. He tried to beat Billy Butler to third to end the inning, but Ryan Zimmerman was unable to tag him out in time, allowing Eric Hosmer to score.

David Lough followed with an RBI single to right.

"We've been playing such good baseball, it's tough to let that kind of game," said Desmond. "We played so well, so many good things happened in that game to let that last inning ruined it, ruined the rest of the trip. We've been playing better and we're showing signs."

Royals reliever Kelvin Herrera (5-6) pitched 1 1/3 scoreless innings to pick up the win while Greg Holland avoided trouble in the ninth to notch his 35th save.

"You can't compete until you can win more games than you lose," said Royals manager Ned Yost. "You have to be able to be over that .500 mark to compete. So, we have to get used, as an organization. We're doing a real good job. These guys are getting great experience. They're learning how to deal with all kinds of pressure."

Alex Gordon homered to lead off the first. After Emilio Bonifacio walked, Hosmer knocked an RBI single to center, but was caught stealing second. Two batters later, Mike Moustakas singled to right center and Perez delivered a two-run shot to left.

The Nationals had a chance to score in the third. With one out, Anthony Rendon doubled to center and Denard Span hit an infield single. However, Zimmerman and Bryce Harper were retired.

Desmond got Washington on the board with a one-out solo shot in the fourth.

In the seventh, Denard Span smashed a two-out solo shot to center. Zimmerman followed with a base hit to left before Harper smacked the first pitch he saw from Royals starter Ervin Santana over the left-field wall to tie the game.

In the ninth, Holland gave a leadoff single to Span and a two-out single to Jayson Werth, but struck out Desmond to end the game.

Game Notes

Gordon has 11 career leadoff home runs, tying the Royals record set by David DeJesus and Willie Wilson ... Desmond has 44 home runs over the last two seasons, second-most for a shortstop. Only J.J. Hardy has more with 45 ... Span went 4-for-5 and is on a nine-game hitting streak ... Harper has 40 career home runs, third-most by any player before his 21st birthday ... The Royals will play a scheduled make-up game against the Rays on Monday. The game is to atone for the May 2 snowout when the clubs managed to get into the fourth inning, with Kansas City holding a 1-0 lead.