PHOENIX — Mike Yastrzemski never experienced a night like Friday. Not in his months in the major leagues, not in the minor leagues and not in Little League.

"Not even in video games," the 28-year-old Yastrzemski said.

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.

For just the second time in major league history, teams combined to hit 12 home runs in a game. The Giants and Diamondbacks were one short of the record 13 homers hit by Arizona and Philadelphia on June 10 at Citizens Bank Park. It was a Chase Field record for the Diamondbacks, who hit five of their six on Friday after the seventh inning.

Yastrzemski also hit a solo homer in the third, and added a two-run blast in the seventh inning. His three-homer game was accomplished in 70 big league games. His Hall of Fame grandfather, Carl Yastrzemski, had one three-homer outing in 3,308 career games. The elder Yastrzemski hit three homers in a game at Tiger Stadium on May 19, 1974.

"Just don't let a good pitch to hit go by," Yastrzemski said of his thought process. "Didn't matter whether it's a fastball, slider, change-up, if it was a good pitch I wasn't going to let it hit the glove."

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 save.

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.

The Diamondbacks lost their third straight and fell below 500 at 61-62. The Giants, 2 1/2 games out of the second wild-card spot in the National League, have taken the first two games of the four-game set.

"It just shows how gritty this team is," Yastrzemski said. "Guys want to win and they want to be here and they want to play, and that's what makes it so fun to be part of a team like this."

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

"We slugged it out and ran out of outs," Diamondbacks manager Torey Lovullo said. "You feel like it was one of those games you want to keep playing the rest of the night until you come out of the right side of it."

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.

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

"A little home run derby going on tonight," Giants manager Bruce Bochy said. "But I'll say this, for those guys in there to win that ball game, a couple of leads there we let get away ... relievers have a tough day, but we picked them up."

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.

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