SAN FRANCISCO -- San Francisco Giants manager Bruce Bochy doesn't necessarily believe his team needs magic to beat the Oakland Athletics. But he was happy Barry Zito packed some Thursday anyway.
"That was a Houdini act," Bochy described of a trouble-filled Zito performance that produced the winning potion in the Giants' 5-2 victory over their cross-bay rivals at AT&T Park.
Pablo Sandoval and Brandon Belt drove in two runs apiece in a four-run sixth inning as San Francisco rallied to snatch one win in the four-game Bay Bridge Series.
"I've said many times: The pitcher on the mound sets the tone," Bochy said of Zito (4-3), who limited the A's to one run before leaving for a pinch hitter in the decisive sixth inning. "It's amazing the job he did today dodging bullets."
The Giants were shut out through five innings by A's starter A.J. Griffin (5-4), but came from behind, allowing the defending World Series champions to keep from getting swept by Oakland for the first time in the 17-year history of interleague play.
In a game of many opportunities but few clutch hits, Griffin recognized the difference was his inability to escape the difference-making sixth as Zito had done many times previously.
"At the end of the day, my job is to not let them score, and they scored four," Griffin said of his 5 2/3 innings. "I wish the outcome was better. You want to win everything when you play your cross-town rivals."
After Griffin held the Giants to one hit through five shutout innings, San Francisco got a pinch-single from Brett Pill to open the sixth. Pill was hitting for Zito, whose team trailed 1-0 at that point.
A one-out double by Brandon Crawford set the stage for Sandoval, who dumped Griffin's next pitch into center field for a two-run single that gave the Giants their first lead since the second inning of Tuesday's loss in Oakland.
Griffin got Buster Posey to fly to center field for the second out, but a Hunter Pence single and a wild pitch put two more runners in scoring position for Belt, who ran the count to 3-1 against left-handed reliever Hideki Okajima before unleashing a two-run double to left-center for a three-run lead.
"It was nice to hit the ball well, score a few runs. That was definitely what we needed," Belt assured. "It would have been nice to win a few more games in a four-game series, but this gives us some momentum."
The Giants' bullpen held on from there, surrendering a seventh-inning run on a Yoenis Cespedes single that San Francisco countered with an unearned run in the bottom of the inning.
Sergio Romo, the Giants' fifth pitcher, worked a perfect ninth for his 14th save.
In starting a Giants victory for the 13th consecutive time at home dating back to last August, Zito survived three hits, six walks and a Giants error to limit the A's to the one run, which Griffin helped produce with a two-out walk.
Despite throwing nearly as many balls (54) as strikes (63), Zito gave the Giants just their third quality start in the last 16 games. San Francisco entered the game tied with San Diego for last in the National League in that category with 21 in the first 53 games.
"We definitely know what we have to do," Zito said of a Giants staff that struggled to capture its 2012 form. "We know we have to be better."
"Today it was pure determination," Bochy said. "He found a way to give us a quality start."
Coco Crisp's second of three hits, a second-inning single, brought home Derek Norris for the run that provided the A's the slim lead they held until Giants rallied in the sixth.
The A's, despite managing only five hits, still found a way to produce 14 base runners. They left 10 stranded.
"We've been getting a lot of guys on base," A's manager Bob Melvin noted on the bright side. "You keep getting guys on base, you're going to bring guys in and you're going to win games."
NOTES: The A's won the Bay Bridge Series 3-1, their first series victory over the Giants since 2008. ... Cespedes' RBI single extended his hitting streak to 12 games. ... Things don't get any easier for the Giants, who flew to St. Louis after the game to meet the Cardinals in a three-game rematch of last year's National League Championship Series. San Francisco ace Matt Cain (4-2) is slated to face St. Louis right-hander Shelby Miller (5-3) in Friday's series opener. ... Giants center fielder Angel Pagan, out since Sunday with a strained left hamstring, made the trip with the team and hopes to return to the top of the San Francisco lineup sometime this weekend. Bochy said he probably wouldn't play Friday, however ... The A's, meanwhile, only had to cross the San Francisco Bay Bridge for a three-game series against the Chicago White Sox that begins Friday night with Oakland's Bartolo Colon (5-2) squaring off against Chicago's Dylan Axelrod (3-3). ... The A's hope to have right fielder Josh Reddick, on the disabled list since May 7 with a sprained right wrist, in the starting lineup for Friday's series opener.