Pablo Sandoval hit a solo shot in the eighth for the Giants.
San Francisco starter Madison Bumgarner extended his Cactus League scoreless streak to 21 1-3 straight innings and retired 13 of the first 14 batters before Davis hit a long home run to left-center in the fifth to tie the game 1-all. Peralta led off the sixth with a 400-foot-plus drive to center field and Gomez followed with his third homer of the spring to left.
''There must have been a home run derby I didn't know about,'' Bumgarner said.
Bumgarner finished with a 1.19 ERA for the spring.
''You don't ever want to give up runs but in a way it's kind of a relief to give up some before the start of the season,'' he said. ''It doesn't really sound like it makes sense, but it kind of does.''
Giants: Bumgarner struck out six in 5 1-3 innings and the slow curveball he's debuting this spring had several Brewers out in front early. But he fell behind twice to Davis, giving up a line-drive single and a long home run.
''I'm not too worried about it. I felt pretty good about the way I threw the ball,'' he said. ''They stretched some (at-bats) out, got into some hitter's counts and did what they're supposed to do.''
Brewers: Peralta ended the spring with his best outing of the season, wiggling out of a jam in the first inning and allowing six singles without a walk.
''I had three pitches going,'' Peralta said. ''The season is right there now, so you're not trying to mess around or work on pitches this close to the start. You want to make pitches like it's a real game. I felt like I was able to pound the strike zone and make pitches I needed to make.''
COME ON ALONG
With an off day on Monday, the Brewers made their final roster selections. Left-handed relief pitcher Zach Duke got the nod over Rob Wooten and Jeff Bianchi won a utility job in the infield over Elian Herrera.
Duke, who had a 4.00 ERA in 10 Cactus League games, struck out 10 and walked three in nine innings. Wooten, who will serve in a late-inning role at Triple-A Nashville, also pitched in 10 games with a 3.86 ERA with 13 strikeouts and one walk in 11 2-3 innings.
Manager Ron Roenicke said Duke will serve as the left-handed relief specialist.
''That doesn't mean that I'm just going to use him against left-hander,'' he said. ''I told him there's going to be times where he's going to have to pitch an inning, and it may be all right-handers.''
Milwaukee has three left-handers in the bullpen. Spring surprise Wei-Chung Wang will have the long-man role, with Will Smith in a setup role.
Bianchi hit .386 this spring with three doubles and six RBIs. In about the same at-bats, Herrera hit .286 with two doubles, two triples, a homer and seven RBIs. He is headed to Nashville.
''Jeff picked up his game this spring,'' Roenicke said. ''He told me coming into this thing that he's going to win that job, and he won the job. I know you don't go by just spring training, but by last year also. We liked what we saw.''
Brewers: Shortstop Juan Segura sat out his sixth straight game with a sore shoulder. Segura has been able to get at-bats in minor league games during his rehab but hasn't played the field.