Dee Gordon was 4-for-5 with two runs scored while Matt Kemp hit a solo home run for the Dodgers, who have won seven of their last nine.
Dan Haren was lifted in the fifth inning after giving up four runs on five hits. Jamey Wright (3-2) went 2 2/3 innings to get the win.
Lorenzo Cain and Jarrod Dyson each hit a solo home run for the Royals, who have lost six of seven.
James Shields allowed four runs on seven hits over seven innings. Wade Davis (5-2) allowed the winning run to take the loss.
A.J. Ellis brought in the winning run in the eighth inning and the Los Angeles Dodgers grabbed a 5-4 win over the Kansas City Royals in the finale of a three-game series.