LOS ANGELES -- Madison Bumgarner allowed one run in 7 2/3 innings to end his four-game losing streak and the San Francisco Giants defeated the Los Angeles Dodgers 2-1 on Saturday night.

Bumgarner (4-9) allowed five hits, struck out five and walked one. The Giants won for just the fourth time in his 14 starts this season.

The Dodgers had clinched their fifth straight National League West title on Friday night and rested several regulars.

Bumgarner blanked the Dodgers for seven innings on July 30, his only other appearance against them this season. He shut them out for seven more on Saturday before Dodgers catcher Austin Barnes led off the eighth with a home run to cut the deficit to 2-1.

Charlie Culberson doubled with one out in the inning and moved to third on a fly ball to right by pinch-hitter Cody Bellinger, the 99th pitch from Bumgarner. Giants manager Bruce Bochy then brought in right-handed reliever Hunter Strickland and he got Chris Taylor to fly out to the warning track in right.

Sam Dyson pitched the ninth for his 14th save.

The Dodgers hadn't put a runner in scoring position against Bumgarner until left fielder Enrique Hernandez doubled over the head of Denard Span in center with one out in the seventh. Hernandez, who came in 13-for-27 in his career against Bumgarner with four doubles and three home runs, was stranded at third.

Gorkys Hernandez and Span had three hits apiece. Hernandez scored both runs and Span and Buster Posey had the RBIs.

Hernandez hit the first pitch of the game from Dodgers left-hander Hyun-Jin Ryu into the left-field corner for his 18th double of the year. Joe Panik sacrificed Hernandez to third and Buster Posey lined a two-out RBI single to center for a 1-0 lead.

Ryu stranded two runners in the second but then was hit in the left hand by a hard comebacker by Panik to lead off the third and was removed from the game.

Ross Stripling entered and pitched the remainder of the third inning and Brandon McCarthy, another former starter who came off his third stint on the DL on Friday, pitched a scoreless fourth in his first appearance since July 20.

The Giants tagged McCarthy for a run in the fifth, however.

Hernandez singled to center, stole second and advanced to third on Panik's grounder to second. Span then lined a single up the middle and Hernandez scored his second run of the game for a 2-0 lead.

Bumgarner, who had lost his past four starts for the first time in his career, walked Taylor to start the first and gave up a single to Kyle Farmer to lead off the third, but both were erased by 4-6-3 double plays. He retired the side in order in the fourth and fifth innings.

NOTES: Dodgers 3B Justin Turner was out of the lineup for a third straight game after suffering a thumb contusion when he was hit by a pitch on Thursday and then feeling the effects of a stomach virus the past two days. ... Dodgers 1B Kyle Farmer made his first major league start and was 1-for-3 against Giants LHP Madison Bumgarner. Farmer came in 4-for-12 (.333) in 12 games this season. His lone extra-base hit was a walk-off two-run double in the 11th inning against the Giants in his first major league at-bat on July 30, a game in which Bumgarner threw seven shutout innings. ... Bumgarner had been supported by 2.8 runs per game this season coming into Saturday, the second fewest of any major league pitcher with at least 100 innings pitched.