Edgar Renteria hit a go-ahead grand slam in the seventh inning and the San Francisco Giants pulled even in the NL wild-card race with Colorado, beating the Rockies 9-5 Sunday for a three-game sweep.

The Giants moved into a tie in the NL West with Colorado, six games behind first-place Los Angeles. The Rockies lost their season-high fifth in a row.

San Francisco swept the Rockies at home for the first time since April 8-10, 2005. Last week, the Giants lost three of four at Coors Field despite leading every game.

Renteria homered with two outs to overcome a 5-2 deficit, connecting two pitches after Rafael Betancourt (0-1) relieved Franklin Morales. Renteria hit his eighth career grand slam and second in two years against Betancourt.

Renteria came out for a curtain call from the sellout crowd of 42,571, the second time in two days it happened for the Giants _ pitcher Barry Zito emerged to tip his cap during Saturday night's 5-3 win. Renteria also doubled in a run and matched his career high with five RBIs. He was intentionally walked in the eighth with two runners on.

Todd Helton and Troy Tulowitzki hit back-to-back solo homers in the fifth inning to put the Rockies ahead, but Colorado's bullpen couldn't hold a 4-1 lead.

Brandon Medders (3-1) recorded two outs in the seventh for the victory. Jeremy Affeldt struck out Garrett Atkins and Carlos Gonzalez with the tying run on third in the eighth, and the pitcher pumped his fist three times leaving the mound.

Closer Brian Wilson pitched the ninth after saving the first two games of the series, with fans chanting "Sweep! Sweep!"

Pinch-hitter Ryan Rohlinger added a two-run single in the eighth and Eugenio Velez an RBI double as the Giants wrapped up a 5-1 homestand.

Tulowitzki hit his 24th homer to go with an RBI double and run-scoring single.

San Francisco, which has been struggling with runners in scoring position, started its rally in the seventh on Juan Uribe's leadoff walk against Morales. Aaron Rowand singled and Fred Lewis was hit in the back by a pitch one out later to load the bases. After Eugenio Velez struck out, Renteria stepped in and produced his biggest hit since joining the Giants this year.

This series was a total swing from the teams' previous meetings. The Rockies rallied for a 6-4, 14-inning win last Monday in which Ryan Spilborghs hit a game-winning grand slam after the Giants had scored three in the top half.

Giants All-Star Matt Cain saw his winless stretch reach seven starts since he beat the Rockies in Denver on July 24.

Gonzalez returned to the Rockies lineup for the first time this series. He hurt his left thumb Thursday diving for a ball and already had stitches in his palm from a separate injury.

NOTES: San Francisco has four grand slams this season. ... The Rockies homered in consecutive at-bats for the seventh time in 2009. ... Giants C Bengie Molina pinch hit but missed his sixth straight start with tightness in his right quadriceps. Molina tested his legs with some running and manager Bruce Bochy expects him to play during the club's upcoming series at Philadelphia. ... Rockies C Yorvit Torrealba singled in the eighth for a career-best 10-game hitting streak. ... Rockies starter Jason Hammel's 53 pitches were his fewest in his 24 starts this year. ... San Francisco sold out for the 17th time.