MILWAUKEE (AP) Hunter Pence's RBI single opened the scoring in a four-run 10th inning, and the San Francisco Giants overcame a rough outing by closer Mark Melancon for a wild 9-5 victory over the Milwaukee Brewers on Thursday.

Denard Span added an RBI double in the 10th off Brewers reliever Jacob Barnes (1-1), who gave up five hits and four runs without retiring a batter.

The Giants rallied after Melancon blew a two-run lead in the ninth. Eric Sogard led off the ninth with a homer, and Travis Shaw's RBI single three batters later tied the game at 5 with no outs before Melancon got the next three hitters.

Melancon (1-1) ended up with the win in spite of giving up three runs and two hits.

The Brewers tried to rally again in the 10th, but Eric Thames ended the game by grounding into a double play against Derek Law with runners on the corners and one out.

The bearded slugger hit a solo homer for the Brewers, his 16th of the year. Thames also lost a ball in the sun in the top of the 10th after Joe Panik hit a sacrifice fly to the warning track that scored the Giants' fourth run of the inning.

The Brewers had momentum until then following the two-run ninth off Melancon. It could have been worse for the Giants, but third baseman Eduardo Nunez, who was playing in, snared a line drive just to his right to save a potential extra-base hit.

The ninth also featured an odd play after Thames reached on a walk. Jesus Aguilar followed with a double to left that got stuck under the padded outfield fence. Left fielder Orlando Calixte retrieved the ball, and a relay throw home to try to get Thames bounced to the backstop, allowing Aguilar to go to third.

The umpires ruled a ground-rule double with the ball lodged at the wall, sending Thames back to third and Aguilar to second. Thames would eventually score on Shaw's single.


Giants: Johnny Cueto threw 106 pitches over five innings, allowing six hits, four walks and three runs, including Thames' homer in the third. The right-hander's eight-game winning streak against the Brewers came to an end with the no-decision. The streak started on Sept. 25, 2012, while he was with the Cincinnati Reds.

Brewers: Milwaukee had to go to its up-and-down bullpen early after starter Paolo Espino went just four innings, allowing five hits and three runs. Espino was called up from Triple-A Colorado Springs to start for Matt Garza, who went on the 10-disabled list this week for a chest contusion.


Giants: C Buster Posey and Pence each got a planned day off from the starting lineup.


Giants: LHP Matt Moore (2-6) gets the start when the team returns home to open a three-game interleague series on Friday with the Minnesota Twins. RHP Sam Dyson, who was acquired this week from the Texas Rangers, is expected to join the team over the weekend.

Brewers: RHP Zach Davies (6-3) goes for a team-high seventh victory when Milwaukee opens a three-game series with the Arizona Diamondbacks. Davies is coming off one of his best outings of the year, when he allowed three hits over six innings in a 3-0 win on Sunday over the Dodgers.


More AP baseball:

Copyright 2017 by STATS. Any commercial use or distribution without the express written consent of STATS is strictly prohibited.