DENVER (AP) — Wilmer Flores delivered a go-ahead sacrifice fly in the 11th inning, Evan Longoria had a grand slam among his three hits and the San Francisco Giants averted a series sweep by beating the Colorado Rockies 9-8 on Sunday.

Elehuris Montero homered for the third time in three games for Colorado. Randal Grichuk and Brian Serven also homered.

The Rockies came back from three- and two-run deficits late to tie it, before the Giants finally prevailed when LaMonte Wade Jr. opened the 11th with a sacrifice bunt off Jake Bird (1-4) to advance automatic runner Mike Yastrzemski to third. Flores followed with a sacrifice fly to right field as the Giants snapped a four-game losing streak. Longoria had a memorable day, offensively and defensively, but said the victory is what he’ll remember most.

“We were up 6-2 in the seventh but they just kept battling back and battling back,” Longoria said. “Games like today, they’re only really fun when you win. If you have to come in here and weather a loss, it’s not as fun.”

Dominic Leone (4-4) picked up the win and Zack Littell got three outs for his first save.

The Rockies' final comeback try in the bottom of the 11th fell short when automatic runner Sam Hilliard was called out at third on a replay review reversal that stood for a game-ending double play. Hilliard was initially ruled safe when advancing on Wynton Bernard’s line out to right fielder Wade Jr., who made the long throw to third for the assist. Longoria caught Wade's relay on one hop, and the replay review showed his swiping tag caught the heel of Hilliard's cleat just before he touched the bag with his outstretched hand. “I knew I touched him and I purposely put myself out in front of the bag to be able to get his foot hopefully before he got to the bag,” Longoria said. “Really the credit goes to LaMonte. He put the throw right on the money and gave me a chance to put the tag on him.”

The Giants took a two-run lead in the 10th on Thairo Estrada’s RBI single and Austin Wynn’s two-out RBI double. But Ryan McMahon led off the bottom of the 10th with an RBI single. One out later, Charlie Blackmon hit the tying RBI single.

Down 6-3 heading into the bottom of the eighth, the Rockies rallied to tie it. Blackmon had a two-out RBI single and Grichuk followed with a two-run drive off Jarlin Garcia, his 13th homer of the season.

Jakob Junis, in his first career start at Coors Field for the Giants, went 6 2/3 innings and allowed three runs on five hits. He left after taking a comebacker off his glove arm from Hilliard. “The X-rays were negative. That’s good news,” Junis said. “Just soreness, swelling, stuff like that. So, hopefully get some treatment this weekend and be good to go by next weekend.”

Kyle Freeland allowed six runs on seven hits in 6 1/3 innings. He had kept the Giants in check heading into the seventh inning but Yastrzemski had a leadoff single and Austin Slater doubled to put runners at second and third. Flores grounded out and J.D. Davis walked, loading the bases and bringing Rockies manager Bud Black out for a mound visit. Black opted to keep Freeland in to face Longoria, who drove Freeland’s first offering into the left field bleachers for his fourth career grand slam and first since 2013 while with Tampa Bay.

The Giants took a 2-0 lead on second-inning RBI singles by Brandon Crawford and Austin Wynns.

Colorado came back to tie it in the bottom of the fifth inning on Serven’s sixth home run of the season. Hilliard had his second basehit of the game ahead of Serven’s homer. BAREHAND PLAY

Longoria’s defense at third base stood out throughout the game but his ninth inning stop of Garrett Hampson’s high hopper was especially eye catching. He stopped the chopper with an over-his-head, bare-hand catch and in one motion fired the throw to first in time to get the speedy Hampson. Said Longoria, “A guy that can run like that, it’s really a do-or-die play, so it was a pretty cool play.” TOUGH ERROR

Colorado third baseman Ryan McMahon nicely gloved Estrada’s sharply hit grounder only to see the ball push its way through the gap in the fingers of his glove and pop out the other side for an error. McMahon went to the dugout after the play and had the laces tightened holding the glove’s index finger and middle finger together.


Rockies: RHP Chad Kuhl threw five scoreless innings in his first rehab start Saturday night for Triple-A Albuquerque. Kuhl, who went on the 15-day injured list Aug. 4 with a right hip flexor strain, allowed three hits, struck out six and walked four. … C Elías Díaz was reinstated from the 10-day injured list after recovering from a left wrist sprain. C Dom Nunez was optioned to Albuquerque.

This $3.5 Million Castle Rock Home Has its Own Baseball Field

This Castle Rock home used to belong to Colorado Rockies manager, Walt Weiss.

More From ESPN Western Colorado