The winning streak is the longest for the Dodgers this season and has come after Los Angeles had lost nine out of 12.
Kershaw (6-5) had gone six straight starts without a victory, but limited the Giants to two runs on four hits with seven strikeouts.
He took the mound in the ninth, but was replaced by Kenley Jansen after giving up a leadoff single to Marco Scutaro.
Jansen then allowed a base hit to Buster Posey, but retired the next three batters to grab his sixth save.
Posey gave the Giants a 2-1 lead in the fourth with a two-run homer, but Los Angeles moved in front with a three-run sixth. Andre Ethier singled in a run in the inning, Mark Ellis doubled home the go-ahead score and Ellis later came in with the final run of the game on a wild pitch.
Tim Lincecum (4-8) took the loss, allowing four runs on 10 hits in 5 1/3.