The Diamondbacks led 3-0 during the middle innings but the Giants forged a tie with three runs in the seventh before Arizona finally struck for the game-winner.
After Paul Goldschmidt was intentionally walked, Chavez cracked the first pitch he saw into the left-center field gap to end the game.
Brad Ziegler (8-1) pitched a 1-2-3 top of the ninth for the D-backs, who bounced back from a 1-0 loss in Friday's three-game series opener.
Kate Moss Playboy shoot is classic Playboy, classic Kate
Theater accidentally screens 'Nymphomaniac' trailer instead of Disney's 'Frozen'