PHOENIX -- So much for the September struggles of Dan Haren.
The right-hander struck out 12 in his first career shutout and the Arizona Diamondbacks beat the San Francisco Giants 2-0 on Tuesday night to avoid losing ground in their long shot bid in the NL West.
Haren (15-8) allowed four hits in his sixth career complete game and first in two years. His strikeout total in the 2-hour, 6-minute performance matched the career best he set for Oakland against Texas in 2006.
"Obviously I've had my struggles," he said. "It's nice to get this feeling again."
The Diamondbacks have won two straight for the first time since sweeping three from San Diego on Aug. 19-21. Arizona is 7-16 since then.
"The last couple of weeks have been a real difficult stretch," Diamondbacks manager Bob Melvin said. "... But we seem to be playing a little better right now."
Haren entered the game with a career September record of 7-13 with a 4.40 ERA and was 0-2 in his last four starts.
"I just had a different mentality," he said. "I was really focused on hitting my spots. I pitched in quite a bit and just focused on keeping it down. If I was going to miss, I was going to miss down in the zone. That's something I got away from. I don't know what to attribute that to, maybe trying to do too much."
He was 2-3 in seven starts since signing a four-year, $44.75 million contract.
"You could tell early on he had that focus back in his eye," Melvin said. "He was throwing his fastball for strikes, wasn't afraid to throw it over the plate."
Snyder homered on the first pitch of the third inning and Drew on the first pitch in the sixth. Both were off Giants starter Matt Cain (8-13). It was Snyder's 16th and Drew's 18th homer of the season.
"We've had two good pitching efforts here and we've just been shut down," said Giants manager Bruce Bochy, whose team lost Monday's series opener 3-1. "These are tough losses when you're getting the kind of pitches we've been getting, but we're seeing it on the other side, too."
Roberts led off the game with a walk and was erased by a double play. Velez walked with two outs in the fifth.
It was Haren's first victory since beating San Diego 8-6 on Aug. 20. He was 0-2 in four starts since. Haren's last complete game came for Oakland against the Los Angeles Angels on July 31, 2006.
Haren, who turns 28 on Wednesday, was aided by the Arizona defense, including a pair of diving stops by first baseman Chad Tracy, one to begin a double play in the first and another to rob Sandoval leading off the seventh.
Cain, in his first game against the Diamondbacks this season, allowed two runs and seven hits in seven innings. He struck out seven with no walks but fell to 0-4 in his last six starts. It was an encouraging showing after he was roughed up by San Diego in his previous start.
"I made two mistakes," he said. "That cost me. Sometimes you can get away with those, but today those were two mistakes that didn't stay in the ballpark."
Gillaspie's hit was his first in the majors. He played for Wichita State this year before being drafted by the Giants. He was called up from Class A Salem-Keizer earlier this month.
Arizona LF Conor Jackson missed his fourth game with a sore shoulder. OF Chris Young sat out the game with a sore wrist. ... Drew was in the lineup after missing two games because of the death of his grandmother. ... The Diamondbacks' last four losses were by one run. ... San Francisco's young ace Tim Lincecum goes against ageless Randy Johnson in the series finale Thursday night.