Updated

DENVER -- Robbie Ray did enough to earn his first win in nearly two months. A late rally by the Colorado Rockies spoiled the celebration for the Arizona Diamondbacks left-hander.

Pinch-hitter Ben Paulsen hit a two-out, two-run single and the Rockies rallied for four runs in the bottom of the ninth for a 5-4 victory Monday night.

A.J. Pollock homered and Chris Owings had three hits for the Diamondbacks, who lost for the seventh time in eight games.

"It was a win we felt like we should've had," Pollock said.

The Rockies were held in check by Ray and two relievers before rallying in the ninth off closer Brad Ziegler (0-3).

After Jose Reyes' double down the right-field line put runners at second and third, Nolan Arenado hit a two-run double off the top of the fence in left to pull the Rockies within a run. One out later Ziegler's errant throw to first on DJ LeMahieu's comebacker put the winning run at second.

"That was definitely the worst pitch I threw," Ziegler said of Arenado's hit. "But even then, I had a chance on the chopper back to me and lost it in the lights, believe it or not. Then when I went to pick it up, I rolled my left ankle so I tried to spin and throw on one foot. It probably wasn't the smartest decision. I should've just ate the ball and kept it first and second."

Ziegler said he may have a "mild sprain" but doesn't think it's serious.

"I'll probably get a day of rest (Tuesday) and hopefully be pretty fresh coming back after that," he said.

Nick Hundley walked to load the bases, finishing Ziegler. Matt Reynolds came on and Paulsen sent an 0-2 pitch up the middle to give Colorado the win.

"I was trying to expand with a fastball and didn't quite get it out there enough," Reynolds said. "You get him in a situation there, you have some opportunities to get the ball out of the zone and hopefully he goes after one, takes a poor swing on one. Just didn't make the pitch."

Charlie Blackmon had three hits and finished a home run short of the cycle for the Rockies, who snapped a three-game home losing streak.

Simon Castro (2-0) got the win after two hitless innings of relief.

Ray allowed one run and five hits and tied a season high with eight strikeouts but remains winless since beating Texas on July 7.

Ray threw 102 pitches while working out of a couple of big jams. In the fourth he stranded a runner at third with one out and in the fifth he retired Arenado and Carlos Gonzalez after issuing two one-out walks.

He faltered in the sixth when he gave up a single and hit a batter with two outs. Randall Delgado came on and got pinch-hitter Kyle Parker to fly out to end the inning.

Colorado's Chad Bettis allowed four runs and 11 hits in his second start since coming off the disabled list. He allowed three runs in the third on Ender Inciarte's RBI single and Pollock's two-run homer.

Colorado got one back in the bottom of the inning when Blackmon led off with a triple and scored on Jose Reyes' groundout.

Paul Goldschmidt doubled and scored on David Peralta's single in the fifth to make it 4-1.

TRAINER'S ROOM

Diamondbacks: 2B Aaron Hill didn't play for the second straight game due to a hand injury. Manager Chip Hale said Hill could be back for Tuesday's doubleheader.

UP NEXT

Diamondbacks: LHP Patrick Corbin (3-3, 3.78) will get the ball in the first game of Tuesday's split doubleheader. RHP Rubby De La Rosa (11-6, 4.46) will pitch the second game.

Rockies: LHP Yohan Flande (3-1, 4.09) starts the first game while RHP Kyle Kendrick (4-12, 6.43) will return from the 15-day DL for the second game. Kendrick has been out since Aug. 1 with right shoulder inflammation.