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.
Eric Thames goes full hulk mode as he rips off his shirt so Brewers fans buy the Flex 10-packs.
Indians manager Terry Francona remembers his father who died on Tuesday night at the age of 84 and shares some memories of his father in Cleveland, specifically throwing out the first pitch.
Drew Butera and Danny Duffy share their fondest memories of former teammate Eric Hosmer as he embarks on his next chapter with the Padres and credit the first baseman for the Royals' World Series victory.
Ned Yost says that there isn't anything he can tell fans about former Royal Eric Hosmer that they don't already know and explains how he found out that the first baseman wouldn't be returning to Kansas City.
As Aaron Judge and Giancarlo Stanton prepare for their first batting practice together, Yankee teammates react to how amazing it will be to watch. Buster Olney adds that having both Judge and Stanton in the same lineup will be like a daily home run derby.
Evan Longoria, who played for 10 seasons with the Rays, is disheartened by Tampa Bay's treatment of Corey Dickerson, whom the team DFA'd over the weekend: "The guy was an All-Star last year. It just doesn't make sense to me."