DENVER — On a throw that’s usually a breeze, Daniel Descalso had the ball sail.

That error paved the way to the decisive run in the ninth inning as the Colorado Rockies lost 3-2 to the San Francisco Giants on Tuesday night. Kelby Tomlinson lined a one-out, tiebreaking single that scored Buster Posey, who reached on Descalso’s errant toss.

“I just didn’t make a good throw at a bad time in the game,” the shortstop said. “I made that throw thousands of times. It sailed on me there and nobody feels worse than me — putting the guy on second base there. I feel like it cost us the game tonight.”

Posey began the top of the ninth by hitting a grounder to Descalso, who fielded it cleanly but overthrew first baseman Gerardo Parra and allowed Posey to cruise into second. Hunter Pence followed with an infield single off closer Adam Ottavino (0-2), who was then replaced by lefty Boone Logan.

After Brandon Crawford struck out, Tomlinson lined an 0-2 fastball into left field to bring home Posey with the decisive run.

“That’s what it’s about — the guys picking each other up,” Giants manager Bruce Bochy said. “Kelby did tonight for us.”

Javier Lopez (1-2) got one out in the eighth to earn the win. Santiago Casilla pitched the ninth for his 31st save. He got Parra to hit into a double play to end the game.

DJ LeMahieu added a two-out, infield single in the third in which Raimel Tapia kept on running from second to score. Tapia also had a sacrifice fly in the fifth.

Tyler Anderson and Jeff Samardzija were locked in a pitcher’s duel most of the game.

Anderson threw 7 1/3 crisp innings, giving up two runs and six hits. The lefty with a deceiving hitch in his delivery has a 3.04 ERA at Coors Field this season.

“Changeup wasn’t as good today as it has been in the past,” Anderson explained. “So we had to make due with cutters and fastballs mostly and when you do that, obviously guys are swinging because they all look like fastballs. So I was able to get them to put the ball in play a lot.”

Samardzija matched the rookie’s performance as he allowed two runs and four hits in seven innings. Samardzija struck out nine.

“That’s what it’s all about, especially in September — got to find a way to win,” Samardzija said.

Anderson ran into trouble in the eighth by surrendering singles to Gorkys Hernandez and Trevor Brown. After a sacrifice bunt, Anderson was taken out for Jordan Lyles. Nunez grounded out to short to bring home the tying run.

Manager Walt Weiss said he never contemplated bringing the infield in to cut off the run.

“That’s suicide. You got two guys in scoring position. You’re at home. You’ll play for the tie there,” Weiss said. “We’ll give up the run and extend the game if we have to. On the road, that probably becomes a tougher decision.”

Nunez’s solo shot in the third was a rare homer for the Giants, who have 37 since All-Star break — the second-fewest in the league.

LeMahieu, who is in a close race for the NL batting title with Washington’s Daniel Murphy, went 3 for 4 on Tuesday and raised his average to .343.

TRAINER’S ROOM

Rockies: OF Charlie Blackmon missed a fourth straight game with tightness in his lower back. “He’s definitely closer,” Weiss said. … OF Ryan Raburn’s bruised left foot remains sore, Weiss said.

ROSTER MOVES

The Rockies recalled RHPs Eddie Butler and German Marquez, along with C Dustin Garneau. They also selected the contracts of INF Pat Valaika and OF Jordan Patterson.

To make room, the team designated INFs Ben Paulsen and Rafael Ynoa for assignment.

THIS & THAT

The Rockies are the only team in the majors with fewer than 10 wins in one-run games. They are 9-18. … Valaika made his major league debut as a pinch-runner in the eighth.

UP NEXT

Giants RHP Albert Suarez (3-3) will make his ninth major league start Wednesday in the final game of the series. The Rockies will throw LHP Jorge De La Rosa (8-7).