Updated

Chicago, IL (SportsNetwork.com) - Buster Posey went 4-for-4 and hit a go-ahead solo home run in the fifth inning as the San Francisco Giants earned a 5-3 win over the Cubs to wrap up an elongated three-game series at Wrigley Field.

The finale of this set wound up being a rubber match after all when the Cubs took the conclusion of Tuesday's protested game, 2-1.

The Giants' bats woke up for the nightcap, as Pablo Sandoval complemented Posey with three hits and two RBI in the club's fifth win in seven games.

Madison Bumgarner (14-9) allowed back-to-back home runs to Justin Ruggiano and Welington Castillo in the first inning but settled in to pitch seven frames. The left-hander struck out a dozen and scattered seven hits and a walk.

The winless streak for Travis Wood (7-11) continued, with the lefty giving up four runs on eight hits over six innings of work. Wood has not won since June 15, going 0-6 in a dozen starts.

Bumgarner came in with a 1.72 ERA on the road this year, good for second in the majors, but put himself in a hole with a pair of mistakes in the first. Ruggiano took him the other way with Arismendy Alcantara on board, and Castillo followed with a blast that landed on Waveland Avenue to give the Cubs an early 3-1 lead.

Sandoval, who singled in a run in the first inning, doubled in another in the third, and Bumgarner helped his own cause with a line drive base hit to drive in the tying run an inning later.

Posey took Wood deep to left-center leading off the fifth, and the Giants added an insurance run in the seventh when Hunter Pence singled, moved to third on a Posey base hit and scored on Michael Morse's sacrifice fly.

The Cubs put their first two hitters on base in the bottom half, and Bumgarner stayed in and worked out of the jam with a pair of strikeouts, the last his fourth punchout of rookie Javier Baez.

"He's been trying to make adjustments," Cubs manager Rick Renteria said of Baez. "It's just a matter of getting pitches in his area that he can do damage with."

Javier Lopez and Sergio Romo combined to pitch a scoreless eighth, and Santiago Casilla shook off a two-out single in the ninth to post his 11th save.

Game Notes

Posey recorded 10 total bases with a home run, two doubles, a single and a walk ... Bumgarner has 13 RBI on the season ... Cubs rookie Matt Szczur recorded his first big-league hit with a single in the seventh inning ... Chicago went 0-for-5 with runners in scoring position.