Ryan Vogelsong, Jean Machi, Jeremy Affeldt and Sergio Romo combined to pitch a two-hit shutout, and the Giants broke through against the Diamondbacks' bullpen in a 5-0 win.
The victory kept the Giants (80-65) 2.5 games back of the first-place Dodgers in the NL West, who shut out the Padres 4-0 at Chavez Ravine on Wednesday night.
San Francisco holds a four game lead over Pittsburgh in the Wild Card race.
For a while Wednesday night, the game had the look of a famous one between the Giants and D'backs on May 29, 2001, when Arizona beat San Francisco 1-0 in 18 innings at AT&T Park.
Then, Kirk Gibson replaced starter Josh Collmenter with Oliver Perez in the seventh inning. On cue, the Giants' vaunted "ground attack" rallied for four runs.
Vogelsong, who had his worst outing of the season at Coors Field a week ago, battled through control issues in the early innings, but still matched Collmenter frame for frame.
Starting pitching report
Vogelsong went about shutting down the D-Backs in a completely different way than Yusmeiro Petit did a night earlier. He gave up one fewer run, too.
Vogelsong surpassed Petit's total number of pitches thrown out of the zone (18) by the second inning. He walked four batters through the first four innings, five overall. Petit struck out nine on Monday; Vogelsong didn't strike out a batter until the fifth.
Here's the similarity: the D-Backs had a very difficult time making good contact on Vogelsong's pitches. He only surrendered two hits through 6 2/3 innings, recording 10 outs on the ground compared to three in the air. He picked up steam after getting out of a bases loaded jam in the second, retiring 13 of the next 14 hitters he faced.
The D-Backs threatened in the seventh on Jake Lamb's one-out double to left-center, and Vogelsong was knocked out of the game after walking Didi Gregorius.
Machi stranded two in the seventh, retiring Jordan Pacheco on a ground ball to Brandon Crawford. Affeldt followed up with a perfect eighth, and Romo struck out two in a one-two-three ninth.
At the plate
Besides a long drive into McCovey Cove off the bat of Joe Panik that went a few feet foul, the Giants made little noise against the D'backs' starter. Collmenter, whose over-the-top delivery has flummoxed the Giants all season, pitched six shutout innings to lower his ERA to 1.00 against the Giants this season in five outings.
The Giants finally broke through in the seventh, as Perez walked Hunter Pence to lead off the inning, and Gregor Blanco hit a double down the right field line. Brandon Crawford reached on an infield single, knocking Perez out in favor of right-hander Evan Crawford.
Without a left-handed bat on his bench, Bruce Bochy sent Matt Duffy to the plate as a pinch hitter. After faking a bunt earlier in the at-bat, Duffy lined a double the other way to score Blanco. A wild pitch scored Crawford and sent Duffy to third, and Angel Pagan capped a four-run inning with a sacrifice fly.
The Giants added a run in the eighth, when Travis Ishikawa's blooper to right scored Pablo Sandoval from third.
Blanco, who many fans were trying to run out of town as recently as mid-August, continues to rake. He led the Giants with two hits -- he's collected at least that many in five of his last seven games.
The pitchers kept the infielders busy with 14 outs on the ground. Sandoval, Crawford, Panik and Ishikawa were up to the task.
The Giants announced a paid crowd of 41,293.
The Giants and Diamondbacks finish up their series on Thursday, as Randall Delgado (3-3, 5.40 ERA) takes on Jake Peavy (5-13, 4.01). Peavy is 4-4 with a 2.36 ERA in eight starts with the Giants. First pitch at AT&T Park is scheduled for 12:45 pm PDT.