Ryan Vogelsong pitched seven innings to outduel San Francisco nemesis Clayton Kershaw for the second time this season and Melky Cabrera homered to help the Giants move within a game of Los Angeles for first place in the NL West with a 2-0 victory over the Dodgers on Tuesday night.

Vogelsong (7-3) followed Barry Zito's seven innings in an 8-0 win in the series opener Monday with his own gem, marking the first time the Dodgers had been blanked in consecutive games in San Francisco since 1987 and for the second time ever.

Cabrera's leadoff homer in the fourth snapped Kershaw's streak of 35 2-3 consecutive innings in San Francisco without allowing an earned run to the delight of the sellout crowd chanting "BEAT L-A! BEAT L-A!" all night. Pablo Sandoval added an RBI single for the Giants, who haven't been this close to first place since after the first day of the season.

Kershaw (5-4) allowed two runs and eight hits in six innings but got no support from the Dodgers' struggling hitters who sorely miss injured slugger Matt Kemp.

Los Angeles has dropped seven of eight on a nine-game California road trip that concludes Wednesday against the Giants, getting outscored 35-13 in the process.

Kershaw had won six straight decisions against the Giants, allowing earned runs in just two of those seven outings before falling 2-1 at home on May 8 when Brett Pill hit a two-run homer and Vogelsong shut down the Dodgers for 7 1-3 innings.

San Francisco used a similar formula to get to the reigning NL Cy Young winner in this game with Cabrera providing the power and Vogelsong once again delivering a stellar start.

As stingy as Kershaw has been in his career in San Francisco, Vogelsong has been almost as tough. He allowed seven hits and lowered his home ERA to 1.85 in his two seasons with the Giants, second to only to the Angels' Jered Weaver (1.55) in that span.

Jeremy Affeldt pitched a perfect eighth and Santiago Casilla finished for his 21st save in 23 chances.

Kershaw had struck out four in setting down the Giants for the first three innings. That all started to change on the second pitch of the fourth inning when Cabrera sent a drive that just cleared the wall in left-center for the first homer Kershaw had allowed in seven appearances in San Francisco.

The Giants didn't stop there, getting three more hits in the inning with Sandoval adding an RBI single before Kershaw escaped a bases-loaded jam by striking out Vogelsong and Gregor Blanco to end the inning.

Kershaw pitched out of trouble again in the fifth, surviving a line drive off his backside by Buster Posey, but it turned out not to matter the way Vogelsong handled the Dodgers hitters.

NOTES: Dave Dravecky and Mike LaCoss shut out the Dodgers on consecutive days in San Francisco in 1987, with LaCoss going 10 innings for his 1-0 win on Aug. 16. ... The Giants had consecutive shutouts against the Dodgers in Los Angeles in April 2002. ... Giants RHP Matt Cain gave his cap, spikes, a ball and other memorabilia from his perfect game on June 13 to the Hall of Fame in a pregame ceremony. He was also given a key to the city by Mayor Ed Lee, who declared that June 13 will now be "Matt Cain Day" in San Francisco. ... RHP Tim Lincecum (2-8) looks to snap a 10-start winless streak when he takes the mound for San Francisco in the series finale Wednesday against RHP Chad Billingsley (4-6).