PHOENIX -- Eric Chavez singled in Willie Bloomquist in the ninth inning to give Arizona a 4-3 victory over San Francisco on Saturday night for the Diamondbacks' 12th walk-off victory of the season.
Bloomquist singled to open the ninth against Sandy Rosario (3-2) and went to second on Adam Eaton's sacrifice bunt. Paul Goldschmidt was intentionally walked to bring up Chavez, whose walk-off hit was his first since an 11th-inning home run against Baston on June 4, 2007.
The Diamondbacks (69-65) lead the major league with 29 one-run victories.
Martin Prado had three hits and scored a run for the Diamondbacks and Miguel Montero had two hits, an RBI and a run. Bloomquist added three singles.
Prado had 43 hits in August, the most in the National League and one behind Detroit Tigers designated hitter Victor Martinez for the major league lead. Prado led the NL with 30 RBIs in August.
Brad Ziegler (8-1) pitched a 1-2-3 ninth inning.
Hunter Pence had three hits for the Giants (60-75) and Gregor Blanco hit his second homer of the season and his first since June 14.
Blanco homered with one out in the seventh inning to end Trevor Cahill's shutout bid. Angel Pagan singled off Cahill's glove hand, stole second, took third on a wild pitch and scored on a triple by Marco Scutaro to knocked Cahill out of the game.
Buster Posey's two-out single to right field tied the score against reliever Josh Collmenter. Posey is 6-for-8 with two homers and seven RBIs against Collmenter in his career.
Prado doubled to right-center field to open the Diamondbacks' three-run fourth and went to third on Aaron Hill's single to left. Montero singled to right and Gerardo Parra followed with a sacrifice fly. After Cahill bunted Montero to second base, Bloomquist singled to center to make it 3-0.
Cahill gave up six singles and three walks in six innings but got out of the fourth and fifth with double-play grounders.
NOTES: Arizona OF Cody Ross spoke to the media for the first time since the Aug. 13 surgery to repair a broken bone in his hip suffered Aug. 11. Ross said doctors assured him the injury was not career-threatening and that he could expect to resume full baseball activities "by the middle part of spring training-ish, somewhere in there," Ross said. "That's the goal." ... RHP Yusmeiro Petit, who will start for the Giants on Sunday, won nine games in 56 appearances (35 starts) with the Diamondbacks from 2007 to 2009. He won his only start for San Francisco this season, beating Colorado on two runs in six innings last Tuesday. ... Giants RHP Matt Cain (right forearm contusion) threw a bullpen session Saturday and remains on track for a start against Arizona on Sept. 7, the first day he is eligible to come off the disabled list.