Oakland outscored the Giants 11-1 while winning the first two games of this home-and-home Interleague series at O.co Coliseum. But the A's dominance dissolved as the Giants delivered a balanced effort before a lively, bipartisan crowd.
The Giants defeated Oakland for the 13th time in their last 15 meetings at AT&T Park.
"I think when you have two teams that play competitive ball against each other, a lot of times home field will come into play," A's manager Bob Melvin said. "We do have a good road record this year [27-19], but I'm sure they got a boost by their crowd tonight as well."
The Giants' ultimate boost was a return to first place in the National League West by a winning-percentage margin of .001 over Los Angeles. It marked only the fourth time since the Giants reached their 42-21 zenith June 8 that they gained ground on the Dodgers in the division race.
The Giants revived the simple yet essential elements of their success. They scored first, improving to 37-11 when that happens.
"It gives you momentum, takes some pressure off you defensively and frees you up a little bit on the offensive side as well," said Buster Posey, who stroked a third-inning RBI single.
San Francisco relied on solo acts, in the form of Hunter Pence's fourth-inning homer, along with group contributions, as every starting position player hit safely or scored a run -- or both. That enabled San Francisco to overcome 2-for-10 hitting with runners in scoring position.
Pence's homer traveled to dead center field and landed in the sustainable produce garden. That prompted jokes about the ball landing in a bed of kale -- one of Pence's favorite vegetables.
"As long as it goes over the fence, I don't care if it's in the kale patch, a glove, a kid's hand ... as long you get the win," he said. "The only reason you hit homers is to win anyways."
That offense provided rare but sufficient support for Matt Cain (2-7), who received two runs or fewer in his previous seven starts. As his record indicated, he needed a win as much as his ballclub did.
"It's definitely not how you want to go into the break, with two wins for a team playing as well as we are," Cain said.
Cain distinguished himself by recovering immediately after faltering. The right-hander surrendered his team-high 13th homer, Stephen Vogt's drive to right field leading off the fourth inning, before retiring Yoenis Cespedes, Brandon Moss and Josh Donaldson, Oakland's 3-4-5 hitters.
Cain committed a throwing error on Alberto Callaspo's fifth-inning comebacker, misfiring on an attempted forceout at second base. That left runners on first and second with one out. Cain escaped by weathering Jason Hammel's sacrifice bunt and retiring Coco Crisp on a grounder to first.
"I was trying not to make it into some big blowup inning and taking one guy at a time," said Cain, who earned the first victory by a Giants starter other than Tim Lincecum since Madison Bumgarner beat Arizona on June 22.
The Giants benefited from solid defense early, with first baseman Brandon Belt making a diving stop of Callaspo's leadoff grounder in the third before Posey threw out Crisp on an attempted steal of second base to end the inning. San Francisco's late-game tonic was the bullpen, as Jeremy Affeldt, Sergio Romo and Santiago Casilla pitched a perfect inning apiece.
Casilla, San Francisco's new closer, has converted save opportunities in the team's last three wins. Romo, the deposed closer, inspired confidence by striking out two batters in one of his sharpest innings of the season.
"We all have our hiccups. He's going to get on track," Bochy said. "This was a great start."