PHOENIX -- In a game with a postseason feel between two playoff contenders, Nolan Arenado let his bat do most of the talking.
Arenado circled the bases, celebrated with teammates and exchanged some words with a heckling fan near the visiting dugout.
"There was a guy, he didn't stop talking the whole game. That was a pretty long game," Arenado said. "It is what it is. It was cool, man. It was fine, and he got me fired up, and lucky I was able to tell him to be quiet there for a second."
The Rockies took the first game of a key four-game series between the National League wild-card leader, Arizona, and second-place Colorado. The Rockies moved four games behind the Diamondbacks and 3 1/2 ahead of St. Louis for the second wild card slot.
Arenado drove in four runs with a double and his 33rd home run of the season, and the Rockies won their seventh straight road game and fifth overall.
Left-hander Tyler Anderson, activated from the 60-day disabled list on Sunday, pitched four scoreless innings in relief for the victory. Anderson (4-5) allowed a hit with four strikeouts.
"I thought as he (Anderson) moved into the game, his stuff was better. He started making pitches," Rockies manager Bud Black said. "You could say he was the key to the game."
The Rockies' winning rally started with two outs in the eighth. D.J. LeMahieu tripled over the top of an extreme defensive shift toward right field and Carlos Gonzalez walked against Diamondbacks reliever Jake Barrett (1-1).
Arenado's home run followed, giving him a major-league leading 123 runs batted in on the season. It was his seventh home run to give the Rockies the lead in the eighth inning or later in his career and the third of 2017.
"It was a bad slider. I didn't get exactly on top of the ball," Barrett said.
The Diamondbacks came back with two runs in the bottom of the eighth off Rockies relievers Jake McGee and Pat Neshek. Paul Goldschmidt's ground out drove in Chris Iannetta, and hot-hitting J.D. Martinez singled in A.J. Pollock to cut Colorado's lead to 5-4.
"We pressed them, they pressed us. We came out on top," Black said.
Martinez, on the same day he was named NL Player of the Week for last week when he batted .429 with seven home runs, went 3-for-4 and scored twice.
Holland stranded runners at second and third, inducing a Pollock ground out to end the game.
"We couldn't get that big hit or that big moment to push across for us," Diamondbacks manager Torey Lovullo said. "We had some opportunities. We just didn't do it."
Diamondbacks starter Zack Greinke allowed two runs on five hits with six strikeouts over seven innings.
Greinke, with his fifth-inning strikeout of Anderson, reached 200 strikeouts on the season for the sixth time in his career, all six times since 2009.
Arenado, known for outstanding defense, made the play of the night when he dived to his right to snag a one-hopper headed down the left-field line off the bat of Pollock in the sixth. Arenado sprang to his feet and threw a one-bouncer to first base just in time for the out.
"I was just happy to stop it," Arenado said.
The bat that Martinez used to hit four home runs at Dodger Stadium on Sept. 4 was packed up at Chase Field and sent to the National Baseball Hall of Fame in New York on Monday.
The Rockies' Charlie Blackmon, with his first-inning double, became the sixth leadoff hitter since 1914 to collect 80 or more extra base hits in a season.
Rockies: Starting pitcher Kyle Freeland was struck in shoulder by a line drive off the bat of Martinez in the top of the fourth, and left the game after being checked by a trainer. The Rockies announced later that Freeland had a left shoulder contusion, and Freeland said he also felt the impact on his jaw.
Freeland said he was OK after the game, though he expected soreness.
"Don't throw fastballs down the middle," he said.
Rockies: RHP Jon Gray (7-4) has a 2.55 earned run average over his last seven starts, but he's 1-2 with 5.40 career ERA against Tuesday's foe, Arizona.
Diamondbacks: RHP Taijuan Walker (9-7) faces Colorado with the Diamondbacks having won in each of his past four starts.
Examining surprising Hall calls for Harold Baines, Lee Smith
While Lee Smith is third on the all-time saves list, Harold Baines' Hall nod is a head-scratcher, considering that he never finished higher than ninth in MVP voting.
Harold Baines, Lee Smith elected to Baseball Hall of Fame
Chicago won the day in Las Vegas, as Harold Baines and Lee Smith were chosen for enshrinement in Cooperstown. The Hall of Fame's Today's Game Era Committee selected them at baseball's winter meetings.
Complete guide to baseball's winter meetings
Who's ready to bet big on Bryce Harper or Manny Machado? Which teams are looking to wheel and deal? We tell you what might go down in the desert.
Former Cubs, Red Sox hitting coach Chili Davis hired by Mets
Chili Davis has been hired as hitting coach of the New York Mets after spending last season in that role with the Chicago Cubs.
Olney: Carrasco's surprising extension changes Indians' plans
The Indians head to the winter meetings ready to shop a starting pitcher, but one veteran found a way to take himself off the block.
Mike Napoli, who made three trips to World Series, announces retirement
Veteran Mike Napoli announced Saturday that he is retiring from baseball, ending a 13-year career highlighted by three trips to the World Series.