With the win, San Francisco now has a five-and-a-half-game lead over the Dodgers in the NL West. Los Angeles also fell two games behind the St. Louis Cardinals for the second wild card spot.
Tim Lincecum picked up the win for the Giants, allowing two runs over 6 1/3 innings. Lincecum allowed just four hits, but walked seven batters. He threw 119 pitches, the third time this season he's thrown more than 115 in a game.
The Dodgers struck first with a run in the top of the third inning, but the lead didn't last long as the Giants tied the game in the bottom of the inning on an Angel Pagan RBI single. An Adam Kennedy solo home run pulled the Dodgers ahead 2-1 in the sixth inning, but once again the Giants had a quick answer, tying the game in the bottom of the sixth.
San Francisco pulled ahead for good in the seventh inning when Marco Scutaro singled in two runs. Scutaro's two-run single came after Josh Beckett intentionally walked Pagan to load the bases. The move backfired and Brandon League came on to replace Beckett following the at-bat.
Beckett took the loss for the Dodgers after he allowed four earned runs over 6 1/3 innings. He struck out three while allowing seven hits. With the loss, he fell to 1-2 in three starts with Los Angeles.
The two teams will continue their series Saturday with first pitch scheduled for 4:05 p.m. ET.