WASHINGTON -- Dusty Baker had a hunch, and it paid off Wednesday afternoon.

The first-year Washington Nationals manager decided to switch Daniel Murphy and Bryce Harper in the batting order, putting Murphy in the No. 3 hole and moving Harper down to the cleanup spot for the first time this season.

"I had that feeling last night," Baker said. "I hope it ignites us."

For one day, it certainly did, as Harper lined a three-run homer to left in the first inning as the Washington Nationals hit three homers overall to beat the Milwaukee Brewers 7-4.

"Whatever (Baker) wants to do, whatever he says goes," Harper said of hitting fourth. "I just want to win ballgames."

The Brewers (37-47) had won four of the first five contests between the teams this year. National League East-leading Washington (51-35) lost three of its previous four games to the last-place Cincinnati Reds and the Brewers.

Jose Lobaton hit a solo shot in the second inning, and Ryan Zimmerman went deep for a two-run blast in the fifth off Matt Garza (1-2).

Garza had not allowed any home runs in his first four starts this year over 21 2/3 innings. However, the veteran right-hander gave up three Wednesday and allowed seven runs on eight hits in 4 1/3 innings.

"I left some pitches up and I didn't get ahead," Garza said. "I was behind in a lot of counts today, and I had to pitch from behind. You just put it in the back of your mind and put it behind and on to the next one."

Garza, who came off the disabled list on June 14 after recovering from a lat strain, is 1-5 with a 7.69 ERA in 10 career starts against Washington. He saw his season ERA rise from 3.74 to 5.54.

"Today he just made too many mistakes in the middle of the plate," Brewers manager Craig Counsell said. "Today was a rough one. He's given up some hits for sure."

Washington starter Tanner Roark (8-5) yielded four runs -- all in the third inning -- on seven hits with six strikeouts in seven innings before lefty Sammy Solis entered in the eighth.

"He's been tough on us," Counsell said of Roark. "We took advantage of some mistakes in that inning. He's tough."

Baker said of Roark: "Tanner has been steady all year long. He has been a big factor in our success."

Washington reliever Sammy Solis recorded one out, and Shawn Kelley got two strikeouts to end the eighth. Jonathan Papelbon fanned three in the ninth for his 17th save.

"He pounded the strike zone," Harper said of Papelbon, who just came off the disabled list Monday after getting over an intercostal strain. "He goes about it the right way. He has been in that role a long time."

Zimmerman hammered a two-run homer to center to make it 7-4 in the fifth.

Stephen Drew hit an RBI double that put the Nationals up 5-4 in the third.

The Brewers scored four runs in the third to tie the game at 4. Scooter Gennett had a two-run single, Jonathan Lucroy drove in a run with a single, and Gennett stole home on the back end of a double steal for the final run.

"A bad job on my part," Roark said of the inning. "You learn from it."

Backup catcher Lobaton, who was getting a rare start, hit a solo homer off Garza in the second to make it 4-0. Both of the homers hit by Lobaton this year have come against the Brewers.

Harper lined a 1-1 pitch into the Brewers bullpen for a three-run homer to give Washington a 3-0 lead. It was the 18th homer of the season for Harper, who was named a National League All-Star starter Tuesday.

Washington has scored 68 runs in the first inning this year. The Nationals entered Wednesday second in the majors in that category, trailing only the Toronto Blue Jays.

Zimmerman and Jayson Werth had two hits for the Nationals, and Lucroy and Jonathan Villar had two for the Brewers, who couldn't overcome the three Washington homers.

"We'll take it today," said Baker, who said he does not know long he will have Harper hit cleanup. "I thought we were more aggressive today."

NOTES: The Brewers called up 1B Andy Wilkins from Triple-A Colorado Springs and sent down RHP Zach Davies, who started Tuesday. That gives Milwaukee another bench player before the All-Star break, and manager Craig Counsell said Davies is set to start the third game after the break. ... Brewers RHP Jimmy Nelson (5-7, 3.56 ERA) will pitch at St. Louis on Friday against RHP Michael Wacha (5-7, 4.38). ... Washington RHP Lucas Giolito (0-0, 0.00 ERA) will face Mets RHP Bartolo Colon (7-4, 2.87) on Thursday in New York in the first of a four-game series. "That is big," Washington manager Dusty Baker said of the series. "I always want to go into the All-Star break hot and come out hot." ... Brewers hitting coach Darnell Coles is a former instructor in the Washington minor league system and was a minor league manager with the Nationals in 2008 at Class A Hagerstown in the South Atlantic League.