Josh Harrison, Andrew McCutchen, Pedro Alvarez and Sean Rodriguez each drove in a run for the Pirates, who snapped a two-game slide. Vance Worley (1-1) went six innings and allowed two runs on six hits while walking four and striking out six.
Gerardo Parra drove in two runs, Jean Segura brought in the other while Khris Davis was 3-for-4 with a run scored for the Brewers, who have lost their last three. Jimmy Nelson (1-1) allowed three runs on five hits in five innings on the mound.
Milwaukee took a 1-0 lead in the second on a run-scoring groundout from Parra that plated Adam Lind, who worked a leadoff walk and moved to third on Davis' one-out double.
Pittsburgh tied the game in the fourth when Francisco Cervelli was hit by a pitch, moved to second on a passed ball, took third when Gregory Planco singled and came home on a ground out by McCutchen.
The Pirates went on top in the fifth with a pair of runs. Marte hit a leadoff single and stole second before coming home two batters later on a Rodriguez single. Rodriguez stole second as Worley struck out and scored on a Harrison single for a 3-1 lead.
Milwaukee got a two-out run in the sixth when Davis kept the inning alive with a single and scored when Parra followed with a double to make it a 3-2 game.
Jared Hughes tossed a 1-2-3 seventh for Pittsburgh and Tony Watson turned the same trick in the eighth.
The Pirates put the game out of reach in the eighth as Alvarez brought home one with a single and Marte followed with a two-run home run for a 6-2 lead.
Segura's RBI single in the ninth accounted for the final score.
The Pirates have not committed an error in 62 straight innings ... The Pirates activated catcher Chris Stewart off the 15-day disabled list on Friday, and optioned catcher Tony Sanchez to Triple-A Indianapolis ... Milwaukee placred outfielder Carlos Gomez on the 15-day disabled list on Friday and recalled utilityman Jason Rogers from Triple-A Colorado Springs.