Mike Yastrzemski hit three home runs, including a tiebreaking solo shot in the 11th inning, and the San Francisco Giants recovered after squandering two late leads, beating the Arizona Diamondbacks 10-9 Friday night.

The teams combined to hit a Chase Field record 12 home runs. The Diamondbacks hit five of their six after the seventh inning.

More Images
San Francisco Giants' Mike Yastrzemski follows through on a solo home run during the 11th inning of the team's baseball game against the Arizona Diamondbacks, Friday, Aug. 16, 2019, in Phoenix. It was Yastrzemski's third home run of the game. (AP PhotoMatt York)

Mike Yastrzemski hit three home runs, including a tiebreaking solo shot in the 11th inning, and the San Francisco Giants recovered after squandering two late leads, beating the Arizona Diamondbacks 10-9 Friday night.

Arizona Diamondbacks relief pitcher Yoshihisa Hirano throws to a San Francisco Giants batter during the 10th inning of a baseball game Friday, Aug. 16, 2019, in Phoenix. (AP PhotoMatt York)

Kevin Pillar homered twice, with his second long ball giving the Giants a 9-7 lead in the 10th inning.

Arizona Diamondbacks catcher Carson Kelly makes the catch to tag San Francisco Giants' Brandon Belt out at the plate on a double by Donovan Solano during the eighth inning of a baseball game Friday, Aug. 16, 2019, in Phoenix. (AP PhotoMatt York)

Brandon Belt also homered for the Giants, who have won five of six.

Arizona Diamondbacks' Eduardo Escobar (5) scores on a bases-loaded walk issued by the San Francisco Giants during the sixth inning of a baseball game Friday, Aug. 16, 2019, in Phoenix. (AP PhotoMatt York)

The Diamondbacks lost their third straight and fell below .500 at xx-xx. The Giants have taken the first two games of the four-game set between teams with National League wild-card implications on the line.

San Francisco Giants' Brandon Belt rounds the bases after hitting a solo home run against the Arizona Diamondbacks during the second inning of a baseball game, Friday, Aug. 16, 2019, in Phoenix. (AP PhotoMatt York)

Giants starter Jeff Samardzija allowed two runs on five hits in 5 1/3 innings.

Yastrzemski had solo homers in the third and 11th, and hit a two-run blast in the seventh inning.

San Francisco Giants' Mike Yastrzemski follows through on a solo home run during the 11th inning of the team's baseball game against the Arizona Diamondbacks, Friday, Aug. 16, 2019, in Phoenix. It was Yastrzemski's third home run of the game. (AP PhotoMatt York)

San Francisco Giants' Mike Yastrzemski follows through on a solo home run during the 11th inning of the team's baseball game against the Arizona Diamondbacks, Friday, Aug. 16, 2019, in Phoenix. It was Yastrzemski's third home run of the game. (AP PhotoMatt York)

Kevin Pillar homered twice, with his second long ball giving the Giants a 9-7 lead in the 10th inning.

The Diamondbacks countered with home runs by Wilmer Flores, his second of the game, and Nick Ahmed off Giants closer Will Smith, sending the game to the 11th inning.

Smith (5-0) picked up the win despite blowing a save chance. He worked 1 2/3 innings. Trevor Gott got Christian Walker to ground out for the game's final out and earned his first career save.

Arizona Diamondbacks relief pitcher Yoshihisa Hirano throws to a San Francisco Giants batter during the 10th inning of a baseball game Friday, Aug. 16, 2019, in Phoenix. (AP PhotoMatt York)

Arizona Diamondbacks relief pitcher Yoshihisa Hirano throws to a San Francisco Giants batter during the 10th inning of a baseball game Friday, Aug. 16, 2019, in Phoenix. (AP PhotoMatt York)

Brandon Belt also homered for the Giants, who have won five of six.

Adam Jones, Ketel Marte and Eduardo Escobar homered for Arizona. Escobar hit his team-leading 28th.

Yoan Lopez (1-5) took the loss after giving up Yastremzki's home run to lead off the 11th.

Arizona Diamondbacks catcher Carson Kelly makes the catch to tag San Francisco Giants' Brandon Belt out at the plate on a double by Donovan Solano during the eighth inning of a baseball game Friday, Aug. 16, 2019, in Phoenix. (AP PhotoMatt York)

Arizona Diamondbacks catcher Carson Kelly makes the catch to tag San Francisco Giants' Brandon Belt out at the plate on a double by Donovan Solano during the eighth inning of a baseball game Friday, Aug. 16, 2019, in Phoenix. (AP PhotoMatt York)

The Diamondbacks lost their third straight and fell below .500 at xx-xx. The Giants have taken the first two games of the four-game set between teams with National League wild-card implications on the line.

Jones' first homer in more than two months tied the game at 7 in the eighth inning, as the Diamondbacks battle back from a 7-2 deficit. Jones hit a three-run shot as a pinch-hitter with two outs.

Arizona got the tying run on base when Marte singled to start the bottom of the 11th. But Smith struck out David Peralta and got Escobar to pop out before Gott entered and closed out the game.

Arizona Diamondbacks' Eduardo Escobar (5) scores on a bases-loaded walk issued by the San Francisco Giants during the sixth inning of a baseball game Friday, Aug. 16, 2019, in Phoenix. (AP PhotoMatt York)

Arizona Diamondbacks' Eduardo Escobar (5) scores on a bases-loaded walk issued by the San Francisco Giants during the sixth inning of a baseball game Friday, Aug. 16, 2019, in Phoenix. (AP PhotoMatt York)

Giants starter Jeff Samardzija allowed two runs on five hits in 5 1/3 innings.

The Diamondbacks took a 1-0 lead when Marte homered to open the bottom of the first. It was Marte's 25th of the season and third leadoff homer of the season and his career.

Belt and Yastrzemski took Diamondbacks starter Mike Leake deep in the third inning. Pillar's home run sailed into the left field seats, scoring Scooter Gennett, who had singled with one out.

San Francisco Giants' Brandon Belt rounds the bases after hitting a solo home run against the Arizona Diamondbacks during the second inning of a baseball game, Friday, Aug. 16, 2019, in Phoenix. (AP PhotoMatt York)

San Francisco Giants' Brandon Belt rounds the bases after hitting a solo home run against the Arizona Diamondbacks during the second inning of a baseball game, Friday, Aug. 16, 2019, in Phoenix. (AP PhotoMatt York)

Leake gave up four runs on eight hits in six innings.

TRAINER'S ROOM

Giants: RHP Johnny Cueto is scheduled for another start with Class A San Jose next week, as he moves closer to a possible return from Tommy John surgery.

Diamondbacks: Peralta banged his left (throwing) hand making a difficult catch in foul territory against the left field fence to end the top of the third inning, but stayed in the game.

UP NEXT

Giants: Top prospect Logan Webb is set for his major-league debut Saturday against Arizona. Webb, 22, has pitched at the rookie, Class A, Double-A and Triple-A levels this season. He was suspended for 80 games earlier this year for testing positive for a performance-enhancing drug.

Diamondbacks: RHP Taylor Clarke was named Saturday's starter before Friday's game, in place of Merrill Kelly, who was moved to Sunday. Clarke is to be officially called up from Triple-A Reno, and is 4-3 with a 5.46 ERA in 13 starts with the Diamondbacks this season.

More AP MLB: https://apnews.com/MLB and https://twitter.com/AP-Sports