MILWAUKEE (AP) -- Christian Yelich hit his major league-leading 23rd home run and Mike Moustakas added two homers to lead the Milwaukee Brewers to a 5-1 win over the Miami Marlins on Thursday.
The Brewers salvaged the final game of the three-game series after getting outscored a combined 24-3 in the first two games. The Brewers are a percentage point behind the Central Division-leading Chicago Cubs.
The Marlins, with the worst record in the National League, had won seven of nine and 13 of 18 overall.
Yelich hit a two-run homer in the first and Moustakas added his first of the game later in the inning to give the Brewers a 3-0 lead. Moustakas homered again in the fourth for his 18th of the season to make it 4-0. Ryan Braun added an RBI single in the seventh.
Freddy Peralta (3-2), making a spot start, struck out nine and gave up one run in six innings. Josh Hader struck out three in 1 1/3 innings for his 14th save in 15 chances.
Peralta didn't allow a ball out of the infield until giving up a leadoff double to Austin Dean in the fourth inning. Then he struck out Garrett Cooper, Brian Anderson and Starlin Castro to leave Dean stranded.
From the second through fourth innings, Peralta struck out eight of nine batters.
Peralta was making his first start since May 13, when he gave up two runs and seven hits in four innings against the Phillies. Peralta, in his second season with Milwaukee, was needed as a starter after Jhoulys Chacin joined Gio Gonzalez on the IL.
It was Peralta's best outing since his April 3 start against the Reds, when he gave up two hits and struck out 11 in eight shutout innings.
Miami's Caleb Smith (3-4) allowed four runs and six hits in five innings. He has lost four of his past five starts.
Trailing 5-1, Miami loaded the bases in the eighth with two outs against reliever Jeremy Jeffress. Hader replaced him and struck out Castro to end the threat.
Brewers: CF Lorenzo Cain, who left in the ninth on Wednesday because of a jammed right thumb, was back in the starting lineup. He went 2 for 3 with two runs scored.
Brewers: RHP Brandon Woodruff (7-1, 3.82) faces RHP Rookie Davis (0-0, 5.87) in the first of a three-game series against the Pirates.
Marlins: RHP Jose Urena (4-6, 4.14) faces RHP Mike Soroka (6-1, 1.41) in the first of a three-game series against the Braves.