MILWAUKEE - Arizona Diamondbacks manager Chip Hale had a feeling Nick Ahmed was going to hit a home run when he batted in the eighth inning.

He was right.

Ahmed hit a tiebreaking solo home run to lead the Diamondbacks to a 7-5 win over the Milwaukee Brewers on Friday night.

"Up until that at-bat, he was having a hard time. They were throwing some really tough pitches," Hale said. "I actually called that home run. So for once in my life I called one right. The way he was taking pitches, I just felt good about that at-bat."

Ahmed's homer off Jonathan Broxton (1-2) put Arizona ahead 5-4, and A.J. Pollock's two-run shot in the ninth extended the lead.

"My first two at-bats tonight were pretty bad. I tried to make an in-game adjustment, and luckily it worked," Ahmed said. "When your teammates have that confidence in you, and your manager, I think it's kind of fun."

Ender Inciarte and David Peralta also went deep, and Paul Goldschmidt had three doubles for the Diamondbacks, who ended a three-game losing streak.

Milwaukee manager Craig Counsell said he thought Broxton could have challenged Ahmed with a good fastball.

"It feels like there's a little bit of a lack of putaway for him," Counsell said.

Addison Reed (2-2) pitched 1 2/3 innings in relief to get the win. Brad Ziegler surrendered a run in the ninth but picked up his third save in five chances.

The Diamondbacks scored a run in the first on consecutive doubles by Goldschmidt and Peralta. Milwaukee's Carlos Gomez hit a 409-foot leadoff homer in the bottom of the inning to tie the score.

Inciarte homered on Jimmy Nelson's first pitch of the third inning to give Arizona a one-run lead. With two outs, Peralta hit another first-pitch home run, extending the lead to 3-1.

Adam Lind had a tying two-run homer to pull the Brewers even again in the bottom of the third.

Arizona loaded the bases with two outs in the fourth off Nelson, but failed to score. Nelson hit two batters in the inning but struck out the side.

The Diamondbacks regained the lead in the fifth on Yasmany Tomas' run-scoring ground out.

Nelson surrendered four runs and seven hits in six innings. He had eight strikeouts and no walks.

Lind tied the game again in the bottom of the fifth with an RBI double off Arizona starter Rubby De La Rosa, who gave up four runs and six hits in five innings. De La Rosa struck out four and walked two.

Milwaukee didn't score in the seventh after loading the bases with one out.

TRAINER'S ROOM

Diamondbacks: C Tuffy Gosewisch was placed on the 15-day DL with an injured left ACL. He sustained the injury on a play at first base on Wednesday. "We'll see if surgery is needed," manager Chip Hale said. "It's terrible. Maybe it's just a slight tear and he'll be able to rehab it." Arizona selected the contract of C Jarrod Saltalamacchia from Triple-A Reno to fill Gosewisch's roster spot. C Oscar Hernandez was transferred to the 60-day DL.

Brewers: SS Jean Segura was reinstated from the 15-day DL. ... Brandon Kintzler was placed on the 15-day DL with left knee tendinitis. Kintzler originally had been designated for assignment. ... RHP Tyler Wagner will be promoted from Double-A Biloxi and make his major league debut with a start on Sunday.

HOME AWAY FROM HOME

After hitting three doubles in five at bats, Goldschmidt is batting .476 (20-42) with nine doubles, four home runs and 12 RBIs in 10 career games at Miller Park. The three doubles tied a personal career high. "(Goldschmidt) had a really good night," Hale said. "They're throwing him nasty pitches, he's fighting them off. He's battling. Just great at-bats."

UP NEXT

Diamondbacks: Jeremy Hellickson (2-3, 5.33 ERA) won his last start on Sunday against the Chicago Cubs.

Brewers: Kyle Lohse (3-5, 5.80) lost his last start on Monday at home against San Francisco. Lohse is 4-3 with a 4.46 ERA in 13 career starts against the Diamondbacks.