Updated

Adrian Gonzalez's game-winning RBI single in the bottom of the 10th inning lifted the Los Angeles Dodgers to a 3-2 win over the San Francisco Giants in the opener of a four-game set.

Carl Crawford led off the 10th with a single against Jeremy Affeldt (1-5). Crawford scampered to second on Nick Punto's sacrifice bunt and Gonzalez lined a base hit up the middle to plate Crawford.

"I take it like any other at-bat with runners in scoring position. It's a great feeling to get a walk-off," Gonzalez said.

The Dodgers' magic number to clinch its first NL West title since 2009 is six.

Yasiel Puig cracked an RBI double for Los Angeles, which had lost five of its last seven tilts coming into the contest.

Brian Wilson (2-1) tossed a scoreless 10th to notch the win.

Hunter Pence smacked a solo homer and Gregor Blanco had a game-tying RBI single in the ninth for the Giants, who had won four of their last six games heading into Thursday.

San Francisco starter Matt Cain permitted two runs -- one earned -- on six hits and a walk over seven frames in the no-decision.

"I felt good, I threw a lot of strikes and I got into a good rhythm," Cain said.

The game was tied 1-1 heading into the home seventh before A.J. Ellis began the inning with a single. Dee Gordon came on to pinch-run for Ellis. He stole second and advanced to third on Mark Ellis' sacrifice bunt.

Pinch-hitter Jerry Hairston struck out, but Puig came through when he ripped a two-bagger into the gap in left-center to bring home Gordon for a 2-1 Los Angeles spread.

San Francisco, though, knotted the game in the ninth against Los Angeles' Kenley Jansen.

Pablo Sandoval singled and was replaced by pinch-runner Juan Perez, who stole second and later advanced to third after Brandon Crawford grounded out. Blanco then lined a base hit to center and plate Perez to make it 2-2.

Pence's leadoff shot in the second opened the scoring, but Ellis' RBI groundout in the home half tied it at 1-1.

Game Notes

Dodgers starter Zack Greinke surrendered a run on four hits and two walks over six innings ... The Dodgers were 2-for-7 with runners in scoring position, while the Giants finished 1-for-5 with RISP.