LOS ANGELES -- Something had to give with two pitchers combining for 20 strikeouts and no walks. In the end, the Giants scratched out a couple of runs that held up and allowed them to regain the NL West lead by a half-game.
Bumgarner dueled Clayton Kershaw through eight innings and emerged with his second scoreless outing of the season for the Giants, who have won six of their past nine games and 11 of 17. They erased the Dodgers' half-game lead in a division race that has seen the rivals frequently swap leads.
"Both guys had great stuff. I enjoyed watching the game," Giants manager Bruce Bochy said. "Bum had great focus out there and concentration. He's a tremendous talent."
Bumgarner (14-7) struck out 10 -- giving him an NL-best 61 strikeouts since the All-Star break -- and walked none to even his road record at 6-6.
"You got to make pitches and can't give in to guys," he said. "Can't give at-bats away, can't give pitches away."
Javier Lopez got the final out in the ninth to earn his second save in four chances after Hanley Ramirez homered with two out in the inning against Sergio Romo, preventing what would have been the Giants' fourth shutout of the season against the Dodgers.
"We had our hands full with Madison," Dodgers manager Don Mattingly said. "He gives you a lot of angles with that crossfire (delivery), and that cutter kind of comes out of his shoulder. We didn't have a whole lot of chances."
The loss spoiled a solid outing by Clayton Kershaw (11-7), who gave up two runs and six hits in eight innings. The reigning NL Cy Young Award winner struck out 10 and walked none as his four-game winning streak ended.
"Their guy threw an outstanding game. He had great command and was tough to square up," Dodgers catcher A.J. Ellis said. "He pitched deep into the game and matched Kersh pitch for pitch. It was one of those games where you knew coming in that it was probably going to be a pitcher's duel, and it was."
Kershaw helped his own cause with two singles and a backhanded diving catch of Gregor Blanco's pop-up bunt in foul territory near the first-base line in the third.
"He has a tendency to bunt sometimes, so it was in the back of my head that he might bunt," Kershaw said. "Once I saw it go up, I just went after it."
"You're always in for a battle against these guys," Kershaw said. "You've got to tip your hat to Bumgarner. He pitched awesome. Two runs ended up being too many, and that's just the way it was."
Sandoval's sacrifice fly in the first inning led to the Giants' first run. His two-out single to short left field in the sixth scored Angel Pagan, who beat Ellis' tag to make it 2-0. Buster Posey went 0-for-4 with three strikeouts and Bochy said before the game that the catcher might either start at first base on Tuesday or get the day off.
The Giants have won 12 of their past 17 road games since the All-Star break. ... Mattingly returned from serving a two-game suspension for arguing with umpires last Thursday in Pittsburgh. ... Kershaw went at least eight innings in consecutive starts for the first time this season. ... Bumgarner improved to 3-1 in five career starts at Dodger Stadium. ... Bumgarner's other scoreless outing was a one-hitter against Cincinnati on June 28, which he won 5-0. ... Three-time Olympic beach volleyball gold medalist Misty May-Treanor received a standing ovation when she was introduced between innings. Her husband, Dodgers catcher Matt Treanor, got congratulatory pats on the back from his teammates in the dugout.