SAN FRANCISCO (AP) Angel Pagan became the first San Francisco player to end a game with an inside-the-park homer, connecting with a runner aboard in the bottom of the 10th inning Saturday to give the Giants a thrilling 6-5 victory over the Colorado Rockies.

Troy Tulowitzki homered leading off the 10th to put the Rockies ahead 5-4, but Colorado closer Rafael Betancourt (1-2) walked Brandon Crawford to open the bottom half.

Guillermo Quiroz sacrificed before Pagan sent a long drive that hit the base of the oddly angled wall in right-center and bounced high over the head of right fielder Michael Cuddyer. The ball caromed away from Cuddyer as the speedy Pagan raced around the bases and slid home ahead of the relay.

The last major leaguer to hit an inside-the-park home run that ended a game was Rey Sanchez for Tampa Bay on June 11, 2004 - also in a 10-inning victory over Colorado, according to STATS.

The previous Giants player to do it was Hall of Famer Bill Terry on Aug. 24, 1931, when the club was in New York. His drive beat the Chicago Cubs 2-1, STATS said.

It was Betancourt's first blown save in 11 chances this season.

Carlos Gonzalez homered among his three hits and drove in two runs for the Rockies. Cuddyer and Jordan Pacheco also drove in runs.

Buster Posey had three hits and scored twice for the Giants, who ended a four-game slide against the Rockies. Hunter Pence, Andres Torres and Marco Scutaro each drove in runs. Crawford and Pablo Sandoval had two hits apiece.

Giants closer Sergio Romo (3-2) gave up Tulowitzki's 10th homer.

Rockies starter Juan Nicasio went five-plus innings, allowing two runs and seven hits. He walked one and struck out two.

Barry Zito lasted six innings, giving up four runs and seven hits. He walked one and struck out three.

Giants manager Bruce Bochy was ejected in the bottom of the eighth by plate umpire Alfonso Marquez for arguing a call at third base after Scutaro appeared to dodge Nolan Arenado's tag on a throw from the outfield.

Marquez called Brandon Belt out at home on a close play in the seventh.

Pence's RBI double in the sixth ended San Francisco's 24-inning scoreless streak against Colorado pitching. Crawford's sacrifice fly and Scutaro's bases-loaded walk brought the Giants within 4-3.

Torres tied the game with a double in the seventh.

Dexter Fowler opened the game with a double and, one out later, Gonzalez hit the first pitch into McCovey Cove beyond the right-field wall.

The Rockies added a pair of runs in the fourth on consecutive doubles from Tulowitzki and Cuddyer, and a one-out single by Pacheco.

Cuddyer has three hits - all for extra bases - and four RBIs in his two games back from the disabled list.

The Giants loaded the bases in the first inning but failed to score. Nicasio retired 13 of his next 16 hitters, twice stranding runners in scoring position.

NOTES: Gonzalez became the first Rockies player to record a ``splash hit'' into McCovey Cove. It was the 27th splash hit by an opponent and the 90th overall since the ballpark opened in 2000. ... The Giants played their major league-leading ninth extra-inning game. ... Centerplate, Inc. concession workers went on a one-day strike, picketing in front of the ballpark. Concessions were staffed by management and others. ... Bochy said a decision on Tuesday's starter, to replace injured RHP Ryan Vogelsong, will be made by Sunday. ... Rockies RHP Jon Garland (3-5, 5.19 ERA) pitches Sunday's series finale. He last faced the Giants on Sept. 9, 2010. ... Tulowitzki extended his hitting streak to 10 games. ... RHP Matt Cain (3-2, 5.12) starts Sunday for the Giants. He will be facing the Rockies for the 30th time.