SAN FRANCISCO (AP) More than 4 1/2 hours of baseball and it was well worth it for Jake Lamb and the Arizona Diamondbacks.
Lamb hit a tying homer with two outs in the ninth inning and doubled home an insurance run in the 11th, rallying the Diamondbacks past the San Francisco Giants 9-7 on Monday night.
Phil Gosselin scored on Jean Segura's go-ahead infield single with two outs in the 11th. Lamb, who homered to right field off closer Santiago Casilla two innings earlier, made it a two-run cushion with his RBI double.
''Like (general manager Dave Stewart) said when he came in, if you're going to play that long you better win,'' Arizona manager Chip Hale said. ''It was exciting. Guys were into it in the dugout. Great game.''
Segura and Lamb had three hits apiece for the Diamondbacks, who scored five runs over the final four innings. Welington Castillo homered and drove in two runs to help Arizona win a game that took 4 hours, 35 minutes, and ended at 11:51 p.m. on the West Coast.
Rubby De La Rosa (1-3), scratched from his scheduled start in this series opener after coming out of the bullpen over the weekend, struck out three for the victory.
Brad Ziegler pitched the 11th for his third save this season and 31st consecutive overall - an ongoing franchise record. With two runners on, he got Brandon Crawford to hit into a game-ending double play.
''The last few outings I've had two guys on with no outs,'' Ziegler said. ''I'm just doing what I can to get soft contact and hope it's at somebody.''
Gosselin reached on a leadoff single against Chris Heston (1-1) in the 11th. Gosselin was sacrificed to second and went to third on a wild pitch before Segura hit a high chopper that bounced just under the glove of second baseman Joe Panik behind the mound.
Panik homered off Diamondbacks starter Archie Bradley, and Angel Pagan had three hits and two RBIs for the Giants.
''We came back and took the lead, but it's tough when you're one pitch away from a win,'' San Francisco manager Bruce Bochy said.
Giants starter Jake Peavy had a better day at the plate than he did on the mound. The 2007 NL Cy Young Award winner gave up four runs over five innings but scored on a wild pitch and drove in a run with a bases-loaded walk in the fifth.
Bradley walked four and gave up five runs over 4 1/3 innings in his season debut.
BACK IN THE BOX
Roberto Kelly was back in his normal spot coaching third base for the Giants after leaving Sunday's loss to the Los Angeles Dodgers when he got hit by an errant throw between innings. This is Kelly's first season coaching third for San Francisco after seven years as the team's first base coach. ''He says he feels pretty good, still feels it a little bit,'' Bochy said. ''A lot of times you get hit in the head and you get a concussion, nausea, throw up. But he had a pretty good night last night. He says he's fine.''
GLAD YOU MADE IT
Diamondbacks RHP Tyler Wagner pitched two scoreless innings after being called up from Triple-A Reno before the game. OF Socrates Brito was optioned down to make room.
TAKE A BREATHER
Slumping 3B Matt Duffy was held out of the Giants' starting lineup but came in as a defensive replacement in the eighth.
Giants: INF Ehire Adrianza (broken foot) is being fitted for a cast and will be restricted from baseball activities for five to six weeks. . RHP George Kontos is expected to be placed on the disabled list because of a flexor strain.
Diamondbacks: LHP Robbie Ray (0-1) has allowed four earned runs over 12 1/3 innings and takes a 2.92 ERA into Tuesday's start against San Francisco.
Giants: RHP Matt Cain (0-1) has 14 career wins against Arizona but is struggling overall this season with a 6.75 ERA in two starts.