SAN FRANCISCO (AP) -- Buster Posey homered with one out in the 17th inning and the San Francisco Giants beat the Cincinnati Reds for the first time this season with a 3-2 victory Friday night.
Posey sent the first pitch he saw from Robert Stephenson (0-2) over the left-field wall for his fourth homer of the week, ending the marathon game after 5 hours, 28 minutes and 480 pitches. The Giants rushed out of the dugout to celebrate with Posey while the few fans remaining cheered.
"It wouldn't have been fun to lose this," Posey said. "We were out of pitching, fortunately got it done there."
Cory Gearrin (1-1) escaped a bases-loaded jam in the top of the 16th by striking out Billy Hamilton. He then stranded two more runners in the 17th to earn the win.
The Reds had won all four meetings so far between the teams, outscoring the Giants 34-7 in those games. They had plenty of chances to win this one as well as they put multiple runners on base in three of the final four innings without scoring.
The best chance came in the 14th when Cincinnati put runners on second and third with one out. Jose Peraza then hit a hard grounder that shortstop Brandon Crawford bobbled before gathering it in time to throw Scott Schebler out at the plate. Bryan Morris then picked Scooter Gennett off second to escape the jam.
San Francisco got nine scoreless innings from seven relievers.
"Got to be a confidence booster for our bullpen," Posey said. "They did a great job with such a potent offense. Put up zeros as much as they did will be big going forward."
Denard Span got the Giants started against Scott Feldman with his 12th career leadoff home run, his second homer in as many games since coming off the disabled list Thursday. He added an RBI single to tie it in the fifth for his sixth hit in two days.
The Reds scored twice in the second against Johnny Cueto when Gennett hit an RBI triple and scored on Tucker Barnhart's sacrifice fly.
Reds: LHP Tony Cingrani will have his next bullpen session pushed back a day or two because of soreness in his injured oblique.
Giants: Closer Mark Melancon (sore forearm) is expected to play catch on Saturday for the first time since going on the DL earlier this week. He is eligible to come off the disabled list Tuesday.
Cueto went a season-high eight innings and was strong until the end. After issuing a nine-pitch walk to Zack Cozart with two outs and no one on in the eighth, Cueto stayed in to face Joey Votto. Cueto got Votto to fly out to left on his 119th pitch to end his night.
BUNT TO BUNT
The Giants opened the fifth inning with back-to-back bunt singles by Eduardo Nunez and Justin Reggiano. Cueto followed with a third straight bunt to advance the runners on the sacrifice. Span followed with an RBI single to tie the game at 2.
Home plate umpire Tony Randazzo had a scary moment in the fifth inning when he was hit square in the mask by a 91 mph Cueto fastball. Billy Hamilton squared to bunt and pulled the bat back at the last minute. Catcher Buster Posey couldn't get his glove on it and the ball hit Randazzo and knocked him straight to the ground. Giants trainer Dave Groeschner rushed out to check on Randazzo, who stayed in the game. He then left after the 13th inning and was replaced by second-base umpire Clint Fagan.
Lisalverto Bonilla (0-0, 7.20) will become the ninth pitcher to start a game this season for the Reds when he takes on Matt Moore (1-4, 6.52).