Starter Kevin Correia (2-5) got the win despite allowing six runs after the Giants had gone up 7-0. Correia allowed seven hits in 5 1/3 innings and contributed an RBI single in putting up his first win in 10 starts.
Brian Wilson retired the Dodgers in order in the ninth to get his 28th save.
The Giants victory followed three straight losses to Arizona.
Casey Blake -- who was ejected in the eighth for arguing a called third strike -- had two hits and scored two runs for the Dodgers, who had swept the Washington Nationals in three games before the Giants came to Dodger Stadium. Mark Sweeney had a pinch- hit two-run double and Andre Ethier and Angel Berroa each drove in a run for LA.
Starter Hiroki Kuroda (5-8) lasted just 3 2/3 innings, allowing seven runs on nine hits.
Dodgers Manager Joe Torre was ejected after arguing Blake's ejection with first-base umpire Greg Gibson.