Brandon McCarthy gave up just one run in eight strong innings and the Diamondbacks scratched across just enough offense to beat the San Francisco Giants 2-1 on Saturday night at AT&T Park.

The win was just the Diamondbacks’ seventh in 18 games against the Giants this season.

The Diamondbacks are 10-12 in their past 22 games.

Another impressive start: Marco Scutaro’s single on a hanging curveball in the third inning drove home Brandon Crawford in the third inning.

But that was the only time the Giants got a runner into scoring position against McCarthy.

“He had great command and good life on his pitches” manager Kirk Gibson said. “He threw a lot of strikes. He just threw the ball well.”

McCarthy has thrown well since getting knocked around in Cincinnati on Aug. 21 allowing just five earned runs in 24 innings for a 1.88 ERA.

He allowed just six hits and one walk in eight innings.

Big adjustment: McCarthy said he detected a mechanical flaw in his delivery after the Cincinnati outing in which he gave up seven runs in 2 2/3 innings.

“My front side had gotten too loose and my glove was getting away from my body” McCarthy said. “When you’re 6-7 if something gets off at the bottom it sways and brings everything off.”