Hunter Pence knocked in two runs and Barry Zito tossed 6 1/3 scoreless innings, as the NL West-leading San Francisco Giants beat the Los Angeles Dodgers, 4-0, in the rubber match of a three-game series.

Buster Posey hit a solo homer for the Giants, who lead the Dodgers by 5 1/2 games for first place in the division. Marco Scutaro had an RBI.

"I thought this was a critical game for us to win," Giants manager Bruce Bochy said. "A lot of good things happened out there. We played very well."

Zito (11-8) gave up four hits while striking out four and walking three for San Francisco, which went 3-3 on a six-game homestand.

Joe Blanton got the start for Los Angeles after Clayton Kershaw was scratched with irritation in his right hip. Blanton (9-13) allowed four runs on six hits and two walks over 5 1/3 innings.

The Giants never looked back after scoring two runs in the first inning. Angel Pagan reached base on an infield single, stole second and moved to third on Scutaro's groundout. Pablo Sandoval walked to put men on the corners. Pence cleared the bases with a two-out double to left-center field.

Scutaro's sacrifice fly in the fifth inning made it a 3-0 game. Pagan hit a one-out triple before scoring on Scutaro's fly ball to right field.

Posey led off the sixth with a homer to center to make it a four-run contest.

"That at-bat you have to tip your cap. It was one of the best at-bats he's ever had against me," Blanton said about Posey, who fouled off six pitches prior to his home run.

Los Angeles' best chance to get back in the game came in the seventh, but with the bases loaded and two outs, Shane Victorino flied out to left field.

Game Notes

San Francisco is 9-6 versus the Dodgers this season ... Blanton fell to 2-6 in 11 career starts against the Giants ... Kershaw received a cortisone shot Saturday after a contrast MRI revealed no structural or labral damage ... Zito has faced the Dodgers 25 times (24 starts) and is 8-10 against them. The Giants have won Zito's last seven outings. This is the first time Zito's team has won seven consecutive games he has started since June 28-Aug. 10, 2005, when Oakland won nine straight of his starts ... Dodgers outfielder Matt Kemp missed his second start Sunday with a frayed shoulder labrum.