Bonds' fifth homer of the season started the second inning, and backed the six-hitter thrown by Barry Zito and two relievers.
Bonds had two of the six hits for the Giants, who have a four-game winning streak.
Zito (2-2) scattered four hits over 7 1/3 innings, with three walks and five strikeouts.
Brad Hennessey pitched 2/3 of an inning and Armando Benitez picked up his fourth save of the season.
Five players all had one hit for the Diamondbacks, who have lost three in a row.
Losing pitcher Edgar Gonzalez (1-2) surrendered an earned run and five hits in seven innings, with no walks and seven strikeouts.