LOS ANGELES -- The Arizona Diamondbacks used the long ball to end a nine-game skid at Dodger Stadium on Monday night.
Goldschmidt added his 29th homer in the eighth inning as the Diamondbacks (72-78) held off a late rally by the Dodgers (85-64) to prevail. Los Angeles catcher Yasmani Grandal hit a two-run homer, his 16th of this season, in the eighth to pull the Dodgers within two runs, but they got no closer.
Arizona's Jhoulys Chacin (1-1), who spent the first three months of the season with the Cleveland Indians before being signed by the Diamondbacks in June, allowed two runs on six hits with four walks and three strikeouts in 5 1/3 innings.
Chacin gave up those runs in the first but kept the Dodgers scoreless for the rest of his stint.
"You know with their offense we were going to have to score some runs," said Goldschmidt, who went 2-for-4. Goldschmidt has 19 career home runs and 60 RBIs, which are tops among active opposing player. "They got those two runs in the first inning. Chacin did a great job. I don't think he gave up a run the rest of the night. For him to put up all those zeros, he gave our offense a chance."
Chacin said he had better command of his off-speed pitches after the first.
"At the beginning, my sinker was up, so they had a better chance of hitting the ball," Chacin said. "I was trying to mix it up more and throw my sinker down."
Diamondbacks left fielder David Peralta had a two-run single in the ninth to cap the scoring.
Closer Brad Ziegler pitched a scoreless ninth to seal the win.
Dodgers starter Brett Anderson (9-9) lasted just 4 2/3 innings, giving up five runs on 10 hits with one strikeout and a walk. Anderson served up two of the three Arizona homers.
"He made a couple of mistakes up and I think we were able to hit him. That was really a turning point," Goldschmidt said.
Dodgers manager Don Mattingly agreed, saying Anderson's lack of control of his breaking ball in the fifth cost him and allowed the Diamondbacks to rally from a two-run deficit with three runs.
"Pretty good early. The first couple (of innings) I thought were pretty good," Mattingly said. "Then all of sudden the breaking ball is up."
First baseman Adrian Gonzalez put the Dodgers up 1-0 with a solo home run to center in the first inning. It was Gonzalez's club-leading 28th home run.
Later in the first, after back-to-back singles by second baseman Howie Kendrick and right fielder Andre Ethier, shortstop Corey Seager lined a double to right, scoring Kendrick for a 2-0 advantage. With the hit, Seager set a Los Angeles record for most consecutive games reaching base to start a career at 16 games in a row. He broke Bill Russell's 1969 mark.
In the third, Arizona right fielder Ender Inciarte scored on a sacrifice fly by center fielder A.J. Pollock to cut the deficit in half.
Leading off the fourth, Tomas hit a solo blast off Anderson, his ninth home run, to tie the score.
An umpire's decision prevented Arizona from scoring more in the inning. With third baseman Brandon Drury at third and two outs, Inciarte dribbled a grounder down the first-base line that Gonzalez fielded. As Inciarte raced toward the bag, he veered to his right and avoided the tag by Gonzalez. However, first base umpire Hunter Wendelstedt called Inciarte out for running outside the base path.
Hill's solo shot -- his sixth homer this season -- lifted Arizona to a 3-2 lead in the fifth. The Diamondbacks added on in the inning thanks to an RBI single by catcher Welington Castillo and a run-scoring groundout by Drury, making it 5-2.
The Dodgers' magic number to clinch the National League West remained at seven.
NOTES: The Dodgers have a shot at setting a record for most wins at home in a season. With the loss to Arizona, the Dodgers have a 50-25 mark at Dodger Stadium, meaning they would need to go 6-0 to eclipse the 55-win season by the 1980 club. ... Arizona 1B Paul Goldschmidt led the National League with a .374 average against left-handers before Monday's contest. His closest competition consisted of Miami Marlins 2B Dee Gordon (.351), Pittsburgh Pirates CF Andrew McCutchen (.349) and teammate A.J. Pollock (.333). ... Diamondbacks LHP Robbie Ray (4-12, 3.72 ERA) will face Dodgers LHP Alex Wood (11-10, 3.63 ERA) in Tuesday's game. ... A crowd of 38,791 attended.