''Anytime you can do something like that, especially when you help your team win a ballgame, is huge and it feels good,'' said Alvarez, who started for only the eighth time this month.
Alvarez, making his second career start at first base, went 2 for 3 with four RBIs, a walk and his seventh stolen base. He said it is difficult to hit well when not playing regularly, but he approaches each game as though he is starting.
''You have no other choice, it's what you have to do,'' he said. ''It's easier said than done sometimes, but the at-bats you do get every once in a while, you have to try to take advantage of them and create an environment where it feels like you're playing every day. Treat every at- bat with the same intensity, same focus.''
Alvarez hit a three-run shot in the fourth inning and a solo drive in the fifth against starter Wily Peralta (15-8). Russell Martin also connected for a three-run homer off the right-hander, who held the Pirates hitless for 3 2-3 innings but quickly fell apart and exited after five.
Pittsburgh starter Edinson Volquez (11-7) pitched out of trouble almost every inning to improve to 3-0 in five August starts. The right-hander allowed 11 hits and two walks in 5 2-3 innings, but Milwaukee managed only two runs off him.
''You got to the point, once those bases were loaded, he was able to put a foot down and just stop it with quality pitches in quality locations,'' Pirates manager Clint Hurdle said.
Third-place Pittsburgh won its third consecutive game to pull within four of the NL Central-leading Brewers.
Each team had 12 hits, but Pittsburgh took advantage of its chances while Milwaukee squandered its opportunities.
''Our big boys were up when we needed them up, but they got the big hits when we didn't,'' Brewers manager Ron Roenicke said.
Martin was 2 for 4 with four RBIs, a double and a walk. Neil Walker went 3 for 4 with a double, a walk and three RBIs.
Scooter Gennett hit his ninth homer in the second for Milwaukee.
After Pittsburgh took a 3-2 lead in the fourth, the Brewers loaded the bases with one out in the bottom half. Volquez got Ryan Braun to pop out and then struck out Aramis Ramirez to end the threat. ''I stayed with the scouting report, basically with the fastball inside,'' Volquez said.
The Pirates have won the first two games of the series but still are only 39-77 at Miller Park. ''This place has been a lot of a Rubik's Cube when we come in here and play. But we always turn the page,'' Hurdle said.
Pirates rookie Gregory Polanco, in a 1-for-27 slump, was on the bench for the fourth consecutive game.
With the Brewers down 9-2 in the sixth, Carlos Gomez was thrown out by a step trying to advance from first to third on a sharp single to left. Starling Marte's throw to Josh Harrison easily beat Gomez for the second out of the inning.
Pirates: INF Clint Barmes has gone 3 for 15 in four rehab games with Triple-A Indianapolis. He's been on the disabled list since July 6 with a left groin injury. ... RHP Stolmy Pimentel (mild right ankle sprain) pitched a scoreless inning Thursday night to begin his rehab assignment with Double-A Altoona.
Brewers: RHP Matt Garza will throw a bullpen session Sunday. He's been on the DL with a left oblique strain since Aug. 5, retroactive to Aug. 4.
Pirates RHP Vance Worley (5-3) looks to bounce back from his worst start of the season when the teams conclude a three-game series Sunday. Worley allowed a season-high six runs in six innings Monday during a 7-3 loss to Atlanta.
Mike Fiers (3-1) will make his fourth start since replacing Garza in the rotation. Fiers has won all three of his previous starts and has a 0.86 ERA in those games.