SAN FRANCISCO -- Wily Peralta carried a shutout into the seventh inning, and Carlos Gomez gave the Milwaukee Brewers a lead they never relinquished with a second-inning home run in a 3-1 victory over the San Francisco Giants on Tuesday night.
While leveling the four-game series 1-1, the Brewers made the most of just five hits, four of which came off hard-luck losing pitcher Matt Cain (7-7).
Peralta (8-11) pitched masterfully after having allowed 12 runs in 8 2/3 innings in his previous two starts. The win was his first since July 14.
The right-hander left with one out in the bottom of the seventh, up 2-0 but with runners on second and third. Right-hander Brandon Kintzler came on to get the final two outs of the inning, allowing the Giants' only run of the night on pinch hitter Joaquin Arias' grounder to second.
Peralta held the Giants to five hits and one run. He walked two and struck out six.
The Giants also stranded the potential tying run on third base in the eighth after Brandon Crawford just missed an inning-opening home run, settling for a double high off the right field fence.
Right-hander Rob Wooten replaced Kintzler at that point and retired the only two Giants he faced, including getting reigning National League Most Valuable Player Buster Posey on a grounder to third with one out and Crawford on third.
Closer Jim Henderson retired Pablo Sandoval on a fly to left field to end the inning, then pitched a hitless ninth for his 16th save after the Brewers tacked on an insurance run in the top of the inning.
Milwaukee (48-65) won for the 40th consecutive time this season when leading after eight innings.
Cain allowed only four hits in seven innings, but three went for extra bases, including Gomez's solo shot to left field in the second. The right-hander gave up two runs, striking out six without walking a batter.
The Brewers' ninth-inning run was unearned after an error on second baseman Arias allowed Norichika Aoki to go from first to third with no outs. Aoki, who also scored Milwaukee's second run four innings earlier, raced home from third on Jonathan Lucroy's sacrifice fly to right field off the third Giants pitcher, Sandy Rosario.
The loss dropped the Giants (50-62) to 20-33 when facing teams under .500.
Losing for the 11th time in their last 16 games, the Giants out-hit the Brewers 6-5.
Gomez's second-inning home run, a solo shot that opened the game's scoring, was his 18th of the season and first since July 26. He had been hitless in his previous 18 at-bats.
The home run was the first allowed by Cain in his past eight starts. He began the season by giving up 16 homers in his first 14 starts.
Cain allowed only one other hit in the first five innings, but it also helped produce a run. Aoki doubled to lead off the fourth, and he scored to make it 2-0 one out later when Giants catcher Posey threw errantly while trying to pick him off third base.
NOTES: Gomez's homer produced the 68th earned run of the season off Cain, who allowed only 68 earned runs all of last season. ... With Lucroy making just his second career start at first base, the Brewers used their 53rd different starting lineup in their past 65 games. ... Manager Ron Roenicke announced that the Brewers would activate RHP Marco Estrada from his injury rehab at Triple-A Nashville to start Wednesday against Giants All-Star LHP Madison Bumgarner. ... Giants manager Bruce Bochy disclosed before the game the organization considered signing veteran LHP Ted Lilly to a minor league contract earlier in the day, but the 37-year-old couldn't pass his physical. ... Giants LHP Barry Zito was presented the Lou Gehrig Award by the Phi Delta Theta fraternity in a pregame, on-field ceremony. The honor is bestowed annually on the major league player who best exemplifies Gehrig's courage and unselfish character.