Arizona has now won 13 of its last 16 against Los Angeles.
The D-backs have not fared as well against other teams of late, having dropped five of six heading into Monday's game.
"We just kind of came out and played with a little more enthusiasm and just tried to take our minds back a couple of weeks ago," manager Kirk Gibson said.
Goldschmidt was 4-for-5 with a home run and three RBIs on the night, including going 3-for-3 with a two-run homer off Capuano. In 15 career at-bats against Capuano, Goldschmidt has 12 hits with three homers and nine RBIs.
"I think after Goldy got the second hit, Capuano just kind of looked at him and said, 'Oh my gosh.'" Gibson said. "It's incredible. It's pretty incredible. It's not very common."
And it's not something that Goldschmidt likes to talk about partly out of respect for Capuano, but also because he knows things like that can turn quickly.
"I've had some good ABs," was about all Goldschmidt would say about the subject. "Tonight, I was seeing the ball well and was able to get some good pitches to hit and make good enough contact to get a couple of knocks."
Goldschmidt started out with singles in his first two at-bats before hitting the two-run homer in the fifth. Capuano threw everything he had at Goldschmidt. In the first at-bat, he hit a slider, the second a changeup and the third a fastball.
"The ball Goldschmidt hit out, I got that one in there and he still hit it out," Capuano said. "It seems like even when I make good pitches Goldschmidt finds a way to get it to the outfield or find a hole. He's got a good approach against me."
Cahill also got in on the offensive action in the second after the Dodgers had taken a 1-0 first-inning lead.
With two outs and runners at first and second, Cahill hit a sinking liner to left. Carl Crawford made a sliding attempt to catch the ball, but it dropped in front of him and bounced all the way to the wall, allowing a pair of runs to score and Cahill to get to third.
"I saw it and I was wanting it to get down," Cahill said of his hit. "I saw him dive. I thought he blocked it or something, and then I saw him running towards the wall and I figured it was time to run a little bit harder."
It was Cahill's first hit of the year, snapping an 0-for-11 streak, and it was also the first extra-base hit of his career.
A.J. Pollock then followed with a double to score Cahill and give the D-backs a 3-1 lead.
After umpires ruled that Crawford had dropped a fly ball off the bat of Didi Gregorius, the D-backs broke things open in the fifth when Goldschmidt followed with a two-run homer to center.
Cody Ross followed Goldschmidt with a homer of his own to put Arizona up 6-2.
The D-backs also tacked on three runs in the ninth.
"Obviously we've been up and down," Goldschmidt said of the D-backs' inconsistent offense this year, "and it was nice to have a consistent nine innings. I think the last inning was pretty big to add on, because I feel like we've had some games where we've scored a few runs and then there's been six innings in a row where we don't score and that gives the other team a chance to come back."
Cahill (2-3) allowed just two runs over seven innings and is 5-0 in his career against the Dodgers. In his last three starts, Cahill has allowed just three earned runs over 20 innings.
"Not as good as last start," Cahill said of how he felt, "but I think the biggest thing was, I was able to make pitches when I had to."