SAN FRANCISCO (AP) -- A month ago, the Giants trailed the Los Angeles Dodgers by a season-high 7 1/2 games, and Melky Cabrera almost singlehandedly produced the offense.
Suddenly, San Francisco is right back in the chase, and well before the All-Star break.
Angel Pagan and Hector Sanchez each drove in two runs as the Giants pulled within two games of the Dodgers for their closest position to first place in the division race since April 7.
''Considering where we were, it's good to be in this situation,'' Giants manager Bruce Bochy said. ''There's so much baseball left, and you're where you want to be, which is right in the middle of things. Even at this stage of the season it's important. You don't want to be too far back.''
Zito (6-5), who had allowed 17 runs in 14 1-3 innings for a 10.67 ERA during the skid, defeated the Dodgers for the first time in 10 appearances and nine starts. He was 0-4 since his last win in the rivalry on May 8, 2009.
It didn't start well when he walked leadoff batter Dee Gordon on five pitches. But Elian Herrera grounded into a double play, and Andre Ethier also grounded out as the left-hander escaped unscathed.
The Dodgers are 0-for the Bay Area so far after they got swept at Oakland last week. This is their first trip to AT&T Park in 2012.
''Everybody's building this series up like it's a big deal,'' Dodgers catcher A.J. Ellis said. ''For us, it's one game. It's a long season, a long grind. We play these guys a lot more throughout the year. Talk to me about the series in August or September and I'll talk about if it's a big series or not.''
Cabrera, coming off consecutive hitless games for just the third time this year, singled in each of his first two at-bats, had an RBI and scored two runs as the Giants gave Zito plenty of support.
San Francisco emphatically took the opener to win the first game of a series for the 10th time in its last 12. The Giants have also won 11 of their last 16 versus Los Angeles in their waterfront ballpark.
An impressive way to kick off a challenging stretch with three straight series against clubs that began the week in first place - also Cincinnati and Washington.
''It's big,'' Zito said. ''They're pretty banged up over there and we've got to capitalize on that.''
Pagan staked Zito to a quick lead with an RBI double against winless Dodgers rookie Nathan Eovaldi aided by a nice bounce off first base. San Francisco got four straight one-out hits off Eovaldi in its four-run first - and the chants of ''Beat L.A.!'' from the sellout crowd of 42,164 began. Sanchez added an RBI single in the inning, prompting a mound visit from pitching coach Rick Honeycutt.
It marked San Francisco's biggest first inning this season. Sanchez doubled in a run in the fifth.
''That's one of those games where you sit there and everything kind of goes their way,'' Dodgers manager Don Mattingly said.
Zito allowed three hits in seven scoreless innings, struck out four and walked three. Two relievers completed the five-hit shutout, San Francisco's seventh. Los Angeles was blanked for the fourth time and second in seven games.
Eovaldi (0-4) was tagged for a season-high eight runs and 10 hits, stretching his winless stretch to 11 starts since a victory in his major league debut last Aug. 6 at Arizona. The 22-year-old right-hander, making his 12th career start, struck out one and walked one in five innings.
''It's a good experience for him. He's going to be fine,'' Mattingly said. ''He's not the kind of kid who's going to get rattled over that.''
Eovaldi retired nine in a row starting with Sandoval's second-inning sacrifice fly before the Giants slugger doubled off the right-field wall in the fifth. Sandoval spent some extra time studying and chatting with hitting coach Hensley Meulens beforehand.
''The last couple days for me were tough. I was swinging too hard,'' Sandoval said.
Bochy sat catcher Buster Posey to rest his tender ankle and went with Zito's regular backstop, Sanchez. That means Posey is likely to catch Tim Lincecum in Wednesday afternoon's series finale as the two-time NL Cy Young Award winner (2-8) looks for his first win in 11 starts since winning at San Diego on April 28.
Notes: RHP Brad Penny, signed to a minor league contract May 18, is nearing a promotion as he prepares for his second stint in San Francisco by pitching for Triple-A Fresno. Bochy said the Giants might stretch him out so he's available for a spot start or long relief. ''We signed him to come up and help us,'' Bochy said. ''We'd like to stretch him a little bit and keep our options open.''... Dodgers GM Ned Colletti, formerly a Giants assistant GM, on San Francisco: ''It's become a great baseball city.'' ... Aubrey Huff, on the Giants' DL since June 15 after he sprained his right knee jumping the dugout rail to celebrate Matt Cain's June 13 perfect game, is close to being able to return. Bochy would like him to do a rehab assignment considering he has missed so much time this season after also spending a stint on the DL with anxiety disorder. ... Reigning NL Cy Young Award winner LHP Clayton Kershaw (5-3) pitches Tuesday night's middle game against Ryan Vogelsong (6-3).
- San Francisco
- Los Angeles Dodgers
- Barry Zito
- Los Angeles
- Pablo Sandoval