Trevor Gott (4-0) earned the win with a scoreless fifth inning and Will Smith got his 20th save.
“That’s what we get paid to do, is come in and put up zeroes,” Gott said.
David Peralta had two hits and reached base four times on the night of a bobblehead giveaway featuring his likeness for Arizona, which has lost a season-high six straight.
The Diamondbacks’ bullpen held the Giants hitless for 4 2/3 innings, until Yastrzemski’s two-run home run with two outs in the top of the ninth.
Arizona took a 3-0 lead in the bottom of the first against Giants starter Tyler Beede after two outs. Peralta scored after a wild pitch and Adam Jones’ single. Jones came in on Christian Walker’s single and Eduardo Escobar was credited with a steal of home.
The Giants came back with two runs in the second against Zack Godley (3-5). Dickerson doubled in Kevin Pillar and Crawford followed with an RBI single.
“It’s been a huge shot in the arm,” Giants manager Bruce Bochy said of Dickerson. “We needed it. We’d been struggling scoring some runs.”
The boos from the home crowd for Godley started when he walked Beede in the second inning, continued when he had a difficulty getting the third out of the third and reached a crescendo when he walked Beede again. By that time the Giants had made it 5-3 on Dickerson’s two-run double and another RBI single for Crawford in the inning.
“I couldn’t put guys away. I got ahead of guys, threw the ball where I wanted all the way to where I got guys where I wanted 0-2, 1-2,” Godley said. “I think I had at least five or six guys 0-2 or maybe 1-2, just couldn’t finish it.”
Crawford’s wide throw to first base on an attempted double play allowed Peralta to score from second base in the bottom of the third to pull Arizona to 5-4.
Godley, in his first start since May 18, allowed five runs and nine hits in four innings.
Beede gave up four runs and six hits in four-plus innings. He was pulled after giving up Peralta’s double to lead off the fifth.
“They’re so reliable,” Beede said of his bullpen teammates. “Needed them for five innings and it was huge. They picked me up.”
FOUR FOR 1,000
Brandon Belt played his 1,000th career game for the Giants, giving San Francisco four current players with 1,000 or more games played for one team for the first time since the 1981 Reds and Dodgers. The other three are Buster Posey, Brandon Crawford and Pablo Sandoval.
In need of some coverage in the infield due to injuries, the Diamondbacks called up Domingo Leyba from Triple-A Reno in time for Saturday’s game. Leyba singled as a pinch hitter in the sixth inning for his first major-league hit in his first career at-bat.
The Diamondbacks also optioned infielder Kevin Cron to Reno and acquired pitcher Ben Lively from the Kansas City Royals in exchange for cash considerations. Lively was assigned to Reno.
Giants: RHP Johnny Cueto, who is working his way back from major elbow surgery at the team’s minor-league facility in nearby Scottsdale, threw a bullpen session before the game at Chase Field. Cueto threw offspeed pitches and hit the high 80s on the radar gun.
Diamondbacks: INF-OF Ketel Marte got Saturday off and could also be held out on Sunday after sustaining a minor groin injury Friday night. Marte, who is among the finalists to be the NL All-Star starting second baseman, felt no pain on Saturday. “I was scared. I was thinking in that moment that I’m not going to be in the All-Star Game,” Marte said. “I feel great.” … INF Jake Lamb (quadriceps) played six innings at first base and got three at-bats for Triple-A Reno on Friday and is close to a return, manager Torey Lovullo said.
Giants: RHP Shaun Anderson (2-2, 4.08 earned run average) is in line for his eighth career start Sunday. He’ll be pitching at Chase Field for the first time in his career.
Diamondbacks: RHP Merrill Kelly (7-7. 3.99) is set to face the Giants for the second time in his career. He’s 3-1 with a 2.22 ERA in June.
More AP MLB: https://apnews.com/MLB and https://twitter.com/AP_Sports