The Diamondbacks produced four runs in both the fifth and sixth innings to break open a tie game and win their third in a row. It was Arizona's 40th victory of the campaign.
Goldschmidt's solo blast touched off Arizona's four-run sixth.
Arizona starter Wade Miley was unable to make it through the fifth. Instead, Will Harris (1-0) came on to record the final out in the fifth and that was enough to bring him the second victory of his career.
Harris has appeared in 35 games with three teams over the last two seasons.
Johnny Cueto (4-1) was roughed up for seven runs on 11 hits in 4 1/3 to take the loss.
Ukrainian protestors topple Lenin statue [VIDEO]
Wisconsin business offering 'therapeutic cuddling' forced to close