Buster Posey singled off the right-field wall in the 13th inning for his fifth career game-ending hit, sending the San Francisco Giants past the Chicago Cubs 5-4 on Wednesday.
Brandon Belt drew a two-out walk from James Norwood (0-1). Andrew McCutchen then singled to bring up Posey, who ended the 4-hour, 30-minute game with San Francisco's first run since scoring four in the first.
Dereck Rodriguez (4-1) pitched three scoreless innings for the win. He also had three of San Francisco's 16 strikeouts.
Norwood worked the 12th and 13th in his major league debut. He immediately struck out Brandon Crawford on a 99 mph fastball.
Cubs slugger Kris Bryant hit a two-run homer in his return from the disabled list, and All-Star Javier Baez tied the game with a solo homer to start the seventh.
Tony Watson's scoreless streak at home ended at 20 2/3 innings with Baez's 18th homer - and Watson hadn't allowed a run in 18 innings overall, which had been the longest active streak in baseball.
San Francisco's Johnny Cueto struck out seven in five innings in his second start back from a lengthy trip to the disabled list with a sprained elbow. The right-hander hasn't won since April 28. Cueto was under a careful watch in just his seventh start of 2018 because of two trips to the DL.
Bryant hit his 10th homer of the year in the fifth following a single by Jason Heyward, who homered leading off the third.
Out since June 23 with inflammation in his left shoulder, Bryant rejoined the Cubs from his Double-A rehab assignment. The 2016 NL MVP started at third base before moving to right field in the ninth.
The Cubs missed a chance when they loaded the bases in the sixth.
Heyward wound up with three hits on a day former Cubs catcher Miguel Montero attended the game to see his old club.
Some of San Francisco's more unheralded contributors staked Cueto to an early cushion.
Chase D'Arnaud homered to begin the first inning for the Giants, the first leadoff drive of his career. Gorkys Hernandez hit a two-run double before Steven Duggar singled him home.
Cubs starter Mike Montgomery gave up eight hits in five innings. He has never beaten the Giants in three starts.