PHOENIX -- Chris Nelson drove home Tyler Colvin to start a four-run rally in the 13th inning, and the Colorado Rockies hung on for a 7-5 victory over the Arizona Diamondbacks on Monday night.
Paul Goldschmidt sent the game into extra innings when he homered off Rockies closer Rafael Betancourt with one out in the ninth to make it 3-3.
Colvin led off the 13th with a ground-rule double off Brad Bergesen (2-1) and Nelson followed with a looping single to center. Charlie Blackmon later added a bases-loaded, RBI single off Mike Zagurski, the Diamondbacks' seventh pitcher. Nelson scored on a fielder's choice and Matt McBride came home on a wild pitch to complete the rally.
Josh Outman (1-3) allowed two runs, walked two and struck out two in 2-3 of an inning for the win.
Josh Roenicke recorded the final two outs for his first career save in his 127th appearance despite issuing a bases-loaded, one-out walk to Konrad Schmidt and a sacrifice fly to Chris Johnson.
The Rockies scored twice in the eighth to take a 3-2 lead against Arizona starter Wade Miley.
Blackmon reached on an infield single and was sacrificed to second. Miley struck out Jordan Pacheco for the second out but Josh Rutledge lined a double off the wall in right-center to tie the game at 2.
Colvin doubled just inside the right-field line, scoring Rutledge for Colorado's first lead.
Miley, making his franchise-record 29th start as a rookie, allowed the three runs and six hits. He struck out a career-high 10 and did not walk a batter for the second time in three starts.
Rockies starter Drew Pomeranz nearly matched Miley during his five-inning stint.
Pomeranz allowed two runs and three hits -- the two solo home runs and a third-inning single by John McDonald. He walked two and matched a career high with seven strikeouts.
Aaron Hill gave the Diamondbacks a 1-0 lead two batters into the game with his 25th home run. Gerardo Parra made it 2-0 when he led off the fifth inning with his first home run in just over three months.
NOTES: The game was the longest in innings for either team this season and the Diamondbacks' longest home game in time. . Goldschmidt returned to the lineup after missing three games with a sore back. . Rockies OF Rafael Ortega, who made his major league debut on Sunday, pinch-hit for Pomeranz in the sixth. . Pomeranz finishes the season 1-4 on the road but was far better than his past three starts, in which he allowed five runs in 10 innings. . Miley struck out the side in the third on nine pitches, the second player to accomplish the feat in the majors this season and the third player in Diamondbacks history following Randy Johnson and Byung-Hyun Kim. . Parra's home run was his first since June 19 against Seattle, a span of 189 at-bats. . LHP Patrick Corbin (6-8) takes the mound for Arizona on Tuesday against Rockies RHP Jhoulys Chacin (3-5). Corbin, who was 3-0 with a 2.77 ERA in four straight early August starts, has gone 1-4 with a 6.94 ERA in his past seven appearances. Chacin is 3-2 with a 3.11 ERA against the Diamondbacks, 2-1 at Chase Field.