DENVER — Bruce Bochy couldn’t throw enough arms at the problem Wednesday night — though he certainly tried — while the San Francisco Giants’ bullpen let a late-season victory slip away.

Cristhian Adames hit a two-run double in the ninth inning off veteran Joe Nathan to rally the Colorado Rockies past the Giants 6-5.

The Giants hold the first NL wild-card spot by half a game over the St. Louis Cardinals and New York Mets. They are 17-32 since the All-Star break.

“Coming down the stretch we need every opportunity, every win we can get,” said Nathan, who had his contract selected from Double-A Richmond on Saturday. “When we get a chance to in the ninth we need to close those deals off and come away with a ‘W’.”

Bochy took advantage of September’s expanded rosters by stuffing his bullpen. San Francisco had 14 relievers available, and the manager used eight, six in the final two innings.

They still couldn’t stop the Rockies.

Nolan Arenado homered to start the final three-run rally, and Tom Murphy and David Dahl also went deep for the Rockies.

With Colorado trailing 5-3, Arenado led off the ninth with his NL-leading 37th home run off Santiago Casilla. After Murphy’s one-out single, Josh Osich (1-1) entered and hit pinch-hitter Charlie Blackmon. Nick Hundley’s bloop single off Nathan loaded the bases, and Adames lined a double off the wall in right to end it.

Jordan Lyles (4-4) pitched the ninth to get the win for the Rockies, who took two of three from San Francisco.

“We’ve had to swallow some tough losses,” Colorado manager Walt Weiss said. “You play close games, tough games, tight games — sometimes you get your heart broken. Sometimes you celebrate like we did tonight.”

The Giants built an early lead on homers by Brandon Belt and Gorkys Hernandez, who had two hits each.

Hernandez, who turned 29 on Wednesday, doubled ahead of Belt’s two-run homer in the second and led off the fourth with his first home run since Oct. 2, 2012, with Miami, to make it 4-1.

The Rockies crept back into the game with consecutive home runs by Dahl and Murphy in the fourth off San Francisco starter Albert Suarez. Hunter Pence made it a two-run game in the fifth with a double, one of his three hits.

“In this place, in a close game, anything can happen,” Bochy said. “You saw what happened there. You see it so many times here. The ‘pen did a great job in the sixth, seventh and eighth. Just couldn’t hold on.

“You got to win games you’re supposed to win.”

TRAINER’S ROOM

Giants: RHP Jake Peavy (strained lower back) was activated off the 15-day disabled list. … Bochy gave INF Joe Panik and OF Denard Span a night off.

Rockies: 1B Gerardo Parra left the game following the first inning after suffering a right hamstring strain stretching for a throw from 3B Nolan Arenado. … RHP Jason Motte (right shoulder strain) threw 25-30 pitches in a simulated game. … 1B Mark Reynolds was away from the team for the birth of his son, Declan James, who arrived Tuesday. Reynolds will join the team in San Diego.

BIG HITTERS

The Giants had 13 hits Wednesday after getting eight the night before. Prior to that, they’d gone five straight with four-or-fewer hits.

UP NEXT

Giants: LHP Madison Bumgarner (14-8, 2.51) opens a three-game series at Arizona on Friday night. Bumgarner has won four of his last five starts and got his fifth double-digit strikeout game against the Cubs on Saturday.

Rockies: RHP Jeff Hoffman (0-2, 6.60) goes for his first major league win in his fourth career start when the team opens a four-game series at San Diego on Thursday.