SAN FRANCISCO — The Arizona Diamondbacks are costing themselves crucial late-season wins by missing scoring opportunities.
Two straight shutouts by the San Francisco Giants and Arizona dropped into a first-place tie with Colorado in the NL West.
Pinch-hitter Gorkys Hernandez singled home the winning run with one out in the ninth inning, lifting the Giants to a 1-0 win on Tuesday night.
"We've got a long way to go. We can't win it today and we can't win it tomorrow," manager Torey Lovullo said. "We've got to play good baseball for another 30-plus days. Our guys are battle-tested. They're smart, they're aggressive, they're tough, and I want them to remember that."
Steven Duggar scored the deciding run moments after what looked like a potentially serious injury. Duggar stayed in the game after making a headfirst slide back into second on Nick Hundley's single after he initially rounded second. Duggar was seen testing his bruised left shoulder, which will be re-evaluated Wednesday.
"I was out there, he was in pain," manager Bruce Bochy said. "He said, 'I'm staying in this game.'"
Going back to Sunday's 5-2 win against Seattle, the Diamondbacks have gone 23 innings without scoring, shut out for the seventh time this season.
San Francisco earned its 12th shutout and extended its winning streak to four games.
"All we can do right now is just kind of put our head down and try to go win today," ace pitcher Madison Bumgarner said. "... We're not going to look behind, we're not going to look ahead. We're going stay focused on that day and then see where we're at at the end of it. It's no secret a lot of stuff has to go right and a lot of stuff has to go wrong."
Brad Ziegler (1-6) walked Duggar with one out, taking the loss for his first decision since returning to the Diamondbacks in a trade from Miami before the deadline.
Will Smith (2-2) pitched a 1-2-3 ninth for the win.
Arizona's Nick Ahmed was thrown out at home to end the eighth as he tried to score from first on pinch-hitter David Peralta's single to deep center.
Diamondbacks reliever Archie Bradley allowed consecutive one-out walks in the eighth then manager Torey Lovullo turned to Andrew Chafin one out later and he retired Brandon Crawford on a groundout with runners on second and third.
Arizona failed to take advantage of a break in the seventh when Giants left fielder Austin Slater flubbed a lazy fly ball by Jon Jay then slid on his backside trying to retrieve the ball for a three-base error.
Bumgarner and Arizona righty Clay Buchholz each pitched seven scoreless innings with nothing to show for it — another pitcher's duel a day after San Francisco's Chris Stratton and Patrick Corbin.
Bumgarner allowed four hits, five strikeouts and four walks. He has surrendered three or fewer runs in 13 of his 16 starts, but had nothing to show for this one. He was coming off eight strong innings in which he gave up one earned run to beat the Mets last Thursday.
Buchholz has allowed only one run over his last three starts and 23 innings.
Ketel Marte doubled to start the fifth but the D-backs couldn't convert, then Arizona loaded the bases in the sixth and Paul Goldschmidt was thrown out at home by third baseman Evan Longoria.
San Francisco has played at least one one-run game in each of its last nine series.
Joe Panik thought he had a two-out double in the third when the play went to review and was overturned in just less than two minutes. He was thrown out at second by center fielder A.J. Pollock and credited with a single.
Diamondbacks: 1B coach Dave McKay was OK after he took a ball to the head during batting practice when it ricocheted about 75 feet off the protective L screen, according to Lovullo. ... Arizona recalled INF/OF Christian Walker from Triple-A Reno to add right-handed hitting depth on the bench and optioned RHP Matt Andriese to Class-A Visalia. Andriese, who also will work out at the team's Salt River Fields facility, will be stretched out to start and the D-backs didn't want to take innings from any potential September call-ups who need innings at Triple-A.
Giants: C Buster Posey is scheduled to return to the Bay Area on Thursday from Vail, Colorado, where he underwent season-ending right hip surgery Monday. Bochy exchanged texts with Posey and said "he's doing great" and is already up and moving around. ... RHP Jeff Samardzija is scheduled for a second opinion on his inflamed pitching shoulder Wednesday from Dr. Tim McAdams at Stanford.
Arizona 13-game winner righty Zack Godley (13-7, 4.59 ERA) is 5-0 with a 4.05 ERA over his last seven road starts and will be opposed in the series finale by standout Giants rookie Dereck Rodriguez (6-1, 2.30 ERA). The right-hander makes his second start since coming off the DL from a strained right hamstring.