DENVER (AP) Carlos Gonzalez hit a two-run homer in the bottom of the ninth inning and the Colorado Rockies beat the Dodgers 8-6 Saturday night, preventing Los Angeles from moving closer to clinching the NL West title.

The Dodgers' magic number remained at two for closing out San Francisco in the division race.

Nolan Arenado hit a grand slam for his 40th home run and Justin Morneau had four hits for the Rockies. Andre Ethier homered for the Dodgers.

More from FoxSports

DJ LeMahieu, who had three hits, led off the ninth with a single against Yimi Garcia (3-4). Gonzalez, who also had three hits, worked the count to 3-1 before hitting a 94 mph fastball over the wall in center for his 39th home run.

Justin Miller (3-2) pitched the top of the ninth for the win.

Colorado's first six batters of the game got hits off Brett Anderson, with Arenado providing the big blow. He followed three straight singles with a drive over the wall in center for his third career slam.

Arenado tied Toronto's Josh Donaldson for the most RBIs in the majors with 121.

Ethier had a two-run homer in the second to slice the deficit in half. Colorado tacked on runs in the second and third to build a 6-2 lead.

The Dodgers got another run in the fifth and chased starter Kyle Kendrick with a three-run sixth to tie it.

Joc Pederson's diving catch on Corey Dickerson's drive to left-center in the Colorado seventh kept the game tied at 6.

RAREFIED AIR

Arenado became the seventh Rockies player to hit 40 or more home runs in a season and the first since the humidor was used starting in 2002.

TRAINER'S ROOM

Dodgers: 1B Adrian Gonzalez was scratched from the lineup because of a pinched nerve in his lower back. Manager Don Mattingly said Gonzalez will also sit Sunday but he added he doesn't think it's serious. ''It's not something honestly that we will worry about,'' Mattingly said. ''Every time he rests it, the back feels good.''

Rockies: SS Jose Reyes missed his third straight game with a sore left Achilles injury. Manager Walt Weiss said he doesn't think Reyes will need to be shut down for the season. ... RHP Miguel Castro is out with a sore back.

UP NEXT

Dodgers: LHP Alex Wood (11-11, 3.60) is 2-1 with a 4.35 ERA in four career starts against Colorado.

Rockies: RHP Chris Rusin (5-9, 5.39) has tossed Colorado's only two complete games at Coors Field this season.