SAN FRANCISCO (AP) The Colorado Rockies are determined to do anything to stay in a crowded National League playoff race.
The San Francisco Giants know they can't miss any more opportunities with the powerful Padres coming to town to close out the season.
Raimel Tapia hit a go-ahead sacrifice fly in the 11th inning, and the Rockies rallied to keep contending San Francisco from gaining ground in the NL wild-card race by beating the Giants 5-4 on Thursday.
''That's definitely a tough loss right there, especially thinking that we had that one in the bag,'' Giants first baseman Brandon Belt said. ''We let up a little bit too early. We needed to keep pushing as an offense and we didn't. We ended up paying for it.''
Jairo Diaz earned his fourth save by getting Austin Slater to ground into a game-ending double play. Several cheering Rockies jumped over the dugout rail celebrating.
The Giants (28-28), winners of three of their last five, dropped behind idle Cincinnati for the first NL wild card. The Reds (29-28) visit Minnesota over the final weekend as the playoff-bound Padres come to San Francisco. Eight NL teams were still in the mix for four remaining postseason spots entering play Thursday.
Trevor Cahill (1-2) took the loss after San Francisco had a chance in the 10th.
Belt - who homered in the eighth inning to tie the game on his 1,000th career hit - and Brandon Crawford were intentionally walked by Daniel Bard (4-2). The infield drawn in, shortstop Trevor Story fielded Evan Longoria's grounder and threw Alex Dickerson out at home as San Francisco failed to capitalize.
''Tough play, it's just very instinctual. You really don't have time to think about it, you just kind of try to set yourself up before the play,'' Story said. ''Longo hits the ball really hard, he hits it at me a lot really hard so I was kind of ready for that.''
Tyler Rogers and Caleb Baragar combined to strike out the Colorado side in the 10th, and the Rockies wound up with a season-high 16 Ks.
Josh Fuentes hit a go-ahead single in the seventh after Charlie Blackmon's tying groundout.
Kevin Gausman struck out nine over six innings and Crawford hit an RBI double, but the Giants' bullpen couldn't hold it.
Gausman matched his second-most strikeouts of the season - he had 11 against Oakland on Aug. 15 - walked one, and allowed two runs on eight hits. He bounced back with a strong outing on the heels of a loss at Oakland his last time out following consecutive winning starts.
The Giants added another run on a wild pitch by Colorado right-hander Chi Chi Gonzalez in the second. Gonzalez is now winless in four career starts against San Francisco.
Ryan McMahon got Colorado on the board with an RBI double in the fourth, then Tapia singled in a run four batters later.
Colorado had two runners on in both the first and second innings but missed scoring chances.
THE WHOLE STORY
Story's steady glove in the 10th made a difference for Colorado.
''That's the play that you have to make. You bring the infield in, you try to cover as many spots on the infield as you can to prevent the ground ball from beating you,'' Rockies manager Bud Black said. ''You bring the outfielders in a little tight, you space them where our spray charts think that the hitter's going to hit the ball, same on the infield, we had three infielders on the left side and two on the right. It's something we practice in spring training.''
DICKERSON VS. ROX
Dickerson doubled in the first as he continued to deliver against the Rockies.
In 10 games this season facing Colorado, Dickerson went .462 (18 for 39) with 12 runs, seven doubles, six homers and 10 RBIs.
VISITING THE BAY
The Rockies won the season series 6-4. Colorado went 2-2 at Oracle Park and hasn't had a winning record in San Francisco since going 6-3 in 2015. The Rockies are 17-26 at Oracle Park since the start of the 2016 season.
Giants: OF Mike Yastrzemski, who missed his sixth straight start with a mild right calf strain, flied out as a pinch-hitter to start the 10th. He again went through pregame baseball work on the field to show the Giants he was ready off the bench. He could be back in the starting lineup as soon as Friday, manager Gabe Kapler said. ... RHP Jeff Samardzija (shoulder) is in the mix for a return Friday. He is 0-2 making just three starts this season and hasn't pitched since Aug. 7. ''Starting a game is on the table for us. He's out on the field playing catch preparing for that possibility,'' Kapler said. ... The Giants continue to monitor RHP Johnny Cueto's sore hip. ''He came out of his last start feeling good. We have no concerns about him making his next start,'' Kapler said.
San Francisco hosts San Diego in a doubleheader Friday with Tyler Anderson (3-3, 4.53 ERA) starting one of the games.
Colorado sends RHP Antonio Senzatela (5-2, 3.13) to the mound for the first game of Friday's doubleheader at Arizona.
More AP MLB: https://apnews.com/tag/MLB and https://twitter.com/AP-Sports