LOS ANGELES (AP) -- Sergio Romo's reflexes gave him and the San Francisco Giants a hard-earned save.
The Giants held off the Los Angeles Dodgers for a 4-2 win on Friday night when pinch-hitter Adrian Gonzalez's hard grounder went off Romo's right foot.
The ball bounced to third baseman Joaquin Arias, who threw to first for the final out after the Dodgers had runners on first and third with two outs.
''Got a little scary there the last couple innings,'' Giants manager Bruce Bochy said. ''He got a break there at the end with a kick save.''
Hunter Pence homered and scored twice and the Giants got to Clayton Kershaw (14-9) with four consecutive singles - the first three with two strikes - to start the seventh.
''It's one of the toughest things in baseball facing Kershaw on his way to probably getting the Cy Young,'' Bochy said. ''We strung together some good at-bats. Guys weren't trying to do too much.''
Mired in last place, the defending World Series champion Giants have been reduced to playing out the string.
''We do want to finish strong,'' Romo said. ''There's a lot of pride here.''
Madison Bumgarner (12-9) allowed two runs and five hits in six innings, extending his streak of allowing three earned runs or fewer in each of his past 18 starts. The left-hander struck out six and walked two in picking up his first win since Aug. 2, a span of seven starts.
''When you're going up against a guy like him (Kershaw), you got to try to at least keep it a tie,'' Bumgarner said.
Romo got the final four outs to earn his 34th save in 38 chances. He gave up consecutive singles to start the ninth, putting the tying runs on with no outs.
Yasiel Puig struck out swinging and Nick Punto hit into a fielder's choice groundout before pinch-hitter Gonzalez's groundout.
''I had to bear down. These guys are no joke,'' said Romo, who challenged Puig. ''If you're going to get beat, you got to get beat with your best stuff.''
Los Angeles had its four-game home winning streak against the Giants snapped, but with second-place Arizona's 7-5 loss to Colorado, the Dodgers' magic number was reduced to four for clinching their first NL West title since 2009.
''It should have been three,'' Kershaw said. ''I'd really like to just have that peace of mind that we clinched because anything can happen.''
Kershaw gave up three runs - two earned - and eight hits in seven innings. The lefty who leads the majors in ERA struck out six and walked none. He had won three straight home starts against the Giants.
''They came right back and battled me all night and got some big hits when they needed to,'' he said. ''The breaks didn't go our way. It was my fault.''
Kershaw has hit a rough patch lately. After giving up a season-high five earned runs and career-worst 11 hits in five innings of a 10-8 road win over Colorado on Sept. 2, he served up two solo homers to Jay Bruce over seven innings in Sunday's 3-2 loss at Cincinnati.
Pence's 22nd homer with two outs in the eighth off Chris Withrow extended the Giants' lead to 4-2.
Pence got a leadoff hit in the seventh and Pablo Sandoval followed with a single. Arias singled, scoring Pence, and Arias took second on a fielding error by Scott Van Slyke.
Brett Pill followed with a single to right, scoring Sandoval and Arias to give the Giants a 3-2 lead.
''We hit some balls hard all night and we thought eventually something would break through,'' said Pill, who came in just 5 for 33 since Aug. 3.
The Dodgers had the tying run on third in the seventh, but Gonzalez struck out swinging to end the inning.
Juan Uribe sent a 1-0 pitch over the left field wall to give the Dodgers a 2-0 lead in the sixth, scoring Michael Young, who singled.
Notes: Dodgers SS Hanley Ramirez sat out a day after leaving in the seventh inning with mild tightness in his left hamstring. The team said an MRI on Friday showed that Ramirez has an irritated nerve in his back rather than a hamstring issue. He received a cortisone injection and is expected to be available to play next week. Ramirez, the team's best hitter with a .342 average, has had two stints on the DL this season. ... Dodgers manager Don Mattingly said that when LHP Chris Capuano returns from a strained groin, he will initially work out of the bullpen. ... Dodgers OF Andre Ethier left the game in the eighth after tweaking his ankle. ... Giants RHP Chad Gaudin, on the DL with carpal tunnel, threw 25-30 pitches to hitters in a simulated game.