PHOENIX -- Carlos Gonzalez has finally found his swing, and that's very good news for the Colorado Rockies.
The veteran slugger homered twice and the Rockies won their sixth game in a row, beating the Arizona Diamondbacks 4-2 on Tuesday night to tighten the race for the National League's top wild card.
"I was hoping I can help this team in the last run," Gonzalez said. "That dream is coming true, so let's keep it going."
Gonzalez drove in all four Colorado runs in his first multihomer game since Aug. 16 last year and is batting .451 (14 for 31) in September.
"All along we've thought our best team is Carlos Gonzalez being Carlos Gonzalez," manager Bud Black said. "No doubt about it."
On July 20, Gonzalez was hitting .218 with six homers. He's got that up to .254 with 12 home runs.
"This is a tough league, a tough sport," he said. "Like I've said before, I know how it feels to be a great player and I know how it feels to be a bad player. This game will always keep you humble. Tomorrow's another day."
He said he struggled "because I'm a human being."
"Even the great players, sometimes they don't look good out there," Gonzalez said. "But the stronger ones stay always positive and always play for each other."
Jon Gray (8-4) gave up two runs and scattered seven hits over seven solid innings, striking out 10 with no walks and a hit batter for the Rockies, who won their eighth straight road game to pull within three games of Arizona for the first NL wild card.
Gray, Black said, had "a three-pitch mix of powerful right-handed stuff."
"Jon's a big boy," Black said. "He's from Oklahoma, and he turns it loose."
Gray matched the season high for strikeouts he set in a win at Arizona on June 30. Chris Rusin got two outs for his second save.
J.D. Martinez homered for the 22nd time in 47 games with the Diamondbacks and just missed another with a double off the top of the right-field fence leading off the ninth. He was stranded at third when Ketel Marte grounded out to end the game.
Martinez's 38 home runs overall this season tied his career high.
Gonzalez's two homers -- one off starter Taijuan Walker, the other off reliever David Hernandez -- hit almost the same spot off the wall above the swimming pool in right field. Hernandez (2-1) pitched two-thirds of an inning and took the loss.
The Diamondbacks have lost two straight to Colorado halfway through a four-game series and have dropped four of their last five, all at home, after a 13-game winning streak.
"Our guys are very well aware of what is at stake," Arizona manager Torey Lovullo said, "and we just have to get after it."
The Rockies' eight-game road winning streak matches their second-longest in club history.
The game was tied at 2 through six innings and lefty Andrew Chafin got Charlie Blackmon to fly out to start the seventh. Hernandez came on and DJ LeMahieu beat the extreme shift Arizona puts on against him with a rare single to left.
Gonzalez followed with his second two-run homer and Colorado led 4-2.
Arizona scored first when Martinez hit Gray's pitch off the edge of the batter's eye, an estimated 447 feet, leading off the second.
The Rockies countered in the third when Blackmon drew a leadoff walk from Walker, and Gonzalez sent Walker's 1-0 pitch to right.
Arizona loaded the bases with no outs in the third but only scored one run on Jake Lamb's sacrifice fly to deep left. Paul Goldschmidt, who is 0 for 8 in the last two games, lined into a double play to end the inning.
"That is the one that stood out more than any other. We get the sac fly to score the one run. Then we have our two best run producers back-to-back and Paul hits the ball well enough, on a line to the shortstop," Lovullo said. "I think we made a little mistake baserunning and it cost us and didn't allow J.D. to get to the plate."
Lovullo confirmed Diamondbacks RHP Randall Delgado has a flexor strain in his throwing elbow. The injury occurred during Delgado's rehab stint. He has been moved to the 60-day DL.
The Diamondbacks send left-hander Patrick Corbin (13-12, 4.16 ERA) to the mound and the Rockies counter with right-hander German Marquez (10-6, 4.27) in the third game of the four-game series Wednesday night.