SAN FRANCISCO -- The San Francisco Giants have found more than their fair share of ways to lose ballgames this season.
However, when it comes to extra-inning affairs, they continue to play like champs.
Six San Francisco relievers shut out the Rockies on four hits over the final eight innings, delivering the Giants a second straight win over Colorado and a seventh win in 10 extra-inning games this season.
"The fight is there. It's been there," Giants manager Bruce Bochy said. "It's good to see them rewarded for it."
Hernandez doubled off the Rockies' seventh pitcher, right-hander Chad Qualls, with one out in the 14th.
After pitcher Cory Gearrin (2-2) struck out, Span grounded a sharp single into right field, and Hernandez easily beat Raimel Tapia's throw to home plate for the Giants' third walk-off win of the season.
The walk-off RBI was the fifth of Span's career.
"Everyone contributed," said Gearrin, who shut out the Rockies on two hits over the final three innings to get the win. "It's always fun walking it off like that. It's why you play."
The Rockies saw their season-worst losing streak reach seven games. They had been 45-0 when in front entering the eighth inning this season.
"It's been a crazy seven days," Rockies first baseman Mark Reynolds said of the losing streak. "It's been rough."
Qualls (1-1), who was working his first inning in the 14th, took the loss.
Span had three hits, and Hernandez and Brandon Belt two apiece for the Giants, who recorded back-to-back wins for the first time since May 27-28.
Steven Okert, George Kontos, Mark Melancon, Josh Osich, Sam Dyson and Guerrin provided the difference-making relief.
"The only way you win a game like this, you need someone to have a big game out of the bullpen," Bochy said. "They all did."
Ian Desmond had three hits, and Tapia and Reynolds two apiece for the Rockies, who have lost five straight to open a nine-game trip.
"It's baseball, man," Reynolds said. "Sometimes you get the break, sometimes you don't. It seemed like we were getting a bunch of breaks early. Now everything seems to be going the other way.
"We need to have a game where we hit good and pitch good at the same time."
The Giants trailed 3-2 before rallying into a tie against the Colorado bullpen in the eighth. Pinch hitter Kelby Tomlinson's one-out single off the Rockies' third pitcher, left-hander Jake McGee, brought home Belt with the game-tying run.
McGee rebounded to strike out Hernandez and pinch hitter Nick Hundley with the potential go-ahead run at third to preserve the tie.
The Rockies had been shut out on four hits over five innings by Giants right-hander Matt Cain before Reynolds, following an intentional walk to Nolan Arenado, belted a three-run homer in the sixth.
The home run, Reynolds' 19th of the year, was the first for the Rockies since Charlie Blackmon led off their game Thursday with a homer against the Arizona Diamondbacks.
Colorado right-hander Scott Oberg replaced starter Jeff Hoffman with two on and two outs in the seventh, and he got Hunter Pence to fly to left.
Neither starting pitcher got a decision.
In attempting to run his road record to 4-0, Hoffman allowed two runs and six hits in 6 2/3 innings. He walked three and struck out six.
Cain was pulled after six innings, having yielded three runs and six hits. He walked three and struck out three. He remains winless in his past 10 starts against the Rockies dating back to May 2013.
Cain contributed to the Giants' first run, dropping down a two-strike sacrifice bunt that advanced Hernandez to second in the third inning. Span followed with a two-out single that plated the run.
NOTES: Rockies 2B DJ LeMahieu left the game in the fourth inning because of a cramp in his right groin. He will not start the series finale Wednesday, Rockies manager Bud Black announced afterward. ... Giants SS Brandon Crawford leads the majors with eight sacrifice flies. ... The Rockies announced Tuesday that LHP Tyler Anderson (strained left knee) would undergo arthroscopic surgery and be out approximately one month. ... Colorado promoted OF Mike Tauchman from Triple-A Albuquerque and demoted RHP Jairo Diaz. In a corresponding move, the Rockies transferred OF David Dahl (stress reaction in rib cage) to the 60-day disabled list. ... The Rockies also announced that LHP Zac Rosscup, acquired from the Chicago Cubs in exchange for minor-leaguer RHP Matt Carasiti, would be sent to Triple-A Albuquerque. ... The Giants reportedly will promote 3B Jae-gyun Hwang from Triple-A Sacramento on Wednesday and place 3B Conor Gillaspie (strained lower back) on the DL.