Gonzalez (2-0) struck out four batters and walked two in just his third career start with the Diamondbacks, who halted a season-long seven game losing streak. Jorge Julio threw a scoreless ninth for his fourth save of the year.
Chad Tracy homered and Shawn Green tripled and scored for Arizona, which won for the first time since federal agents raided the home of former Diamondbacks reliever Jason Grimsley in search of human growth hormone.
Eliezer Alfonzo's home run accounted for the only run for the Giants, who have lost four in a row and for the fifth time in their last six games.
Jamey Wright (5-6) took the loss despite pitching seven strong innings, yielding just two runs on six hits, with two walks and a strikeout.
Barry Bonds made his return to the San Francisco lineup after sitting out for a week with an injury to his left side, finishing 0-for-3 with a walk.
NY rabbi using karate to attack the 'knockout game'
Fan wears 'Forced Sex University' shirt to insult FSU on Saturday