WASHINGTON (AP) -- Bryce Harper hit the first of Washington's three home runs, and the Nationals returned to form in a 7-4 victory over the Milwaukee Brewers on Wednesday.
Jose Lobaton and Ryan Zimmerman also connected for the Nationals, who averted a three-game sweep.
After watching Washington score a combined two runs in the first two games of the series, manager Dusty Baker said before the finale, "We're operating at a low energy level right now."
Harper remedied that with a three-run shot in the first inning, the Nationals' first long ball in three games. Lobaton made it 4-0 in the second and Zimmerman chased Brewers starter Matt Garza (1-2) with a two-run drive in the fifth for a 7-4 lead.
Tanner Roark (8-5) allowed four runs and seven hits in seven innings for the Nationals. The right-hander also beat the Brewers on June 26 to help Washington dodge a three-game sweep.
Jonathan Papelbon worked the ninth for his 17th save in 19 chances.
The NL East-leading Nationals open a four-game series Thursday night at the second-place New York Mets before heading into the All-Star break.
Scooter Gennett had two RBIs and stole home for the Brewers. Despite the loss, Milwaukee finished 4-2 against the Nationals to win the season series for the first since 2010.
Garza gave up seven runs, eight hits and two walks in 4 1/3 innings. He is 1-5 with a 7.69 ERA in 10 starts against Washington.
The right-hander ran into difficulty almost immediately, giving up singles to Ben Revere and Jayson Werth before Harper hit his 18th home run, an opposite-field poke to left.
After retiring the first six batters, Roark gave up five singles in the third. Milwaukee drew even when Gennett scored on the front end of a double steal.
Stephen Drew hit a two-out RBI double in the bottom half for a 5-4 lead.