SAN FRANCISCO -- The Giants slammed the Rockies back on Sunday afternoon.

Edgar Renteria's seventh-inning grand slam gave the Giants a 9-5 victory and a three-game sweep, putting the Giants in a tie with the Rockies atop the National League Wild Card standings.

It was revenge for the Giants, who watched the Rockies celebrate when Ryan Spilborghs knocked a 14th-inning grand slam to beat the Giants, 6-4, at Coors Field on Monday night. The Giants' victory Sunday meant they won four of the seven meetings with the Rockies between Aug. 21 and Sunday.

"We punched at them over in Denver, and they punched back, to their credit," Rockies manager Jim Tracy said.

The Rockies' Troy Tulowitzki hit his 24th homer of the year, immediately after Todd Helton hit his 13th, and Ian Stewart finished a homer shy of a cycle. However, the Rockies were left with their first five-game losing streak of the season.

"I think it was bound to happen sooner or later, but it's pretty impressive that you get this late in the year and this is your only streak like that," Tulowitzki said. "I'll tell you what, if you talked to me after April and said there'd be 31 games left and you'd be tied for the Wild Card, would you take it? I would have."

The Rockies meet the Mets on Tuesday to open a 10-game homestand that puts them against two other lower-division teams, the D-backs and the Reds. Meanwhile, the Giants travel to face the NL East-leading Phillies and the Brewers in a six-game trip.

"It's fun, isn't it?" said Giants starter Matt Cain, who gave up four runs and eight hits in six innings but happily accepted the no-decision. "You really can't count anybody out, especially when you're gong to be playing those teams that are ahead of you."

Giants manager Bruce Bochy said, "We did what we needed to do this weekend."

Renteria, who has four home runs but two in the just completed seven-game, home-and-home series with the Rockies, went deep on an 0-1 fastball from Rafael Betancourt, who went to 0-1 since being acquired by the Rockies.

Tracy went to Betancourt after left-hander Franklin Morales -- who escaped a no-out, two-on jam in the sixth -- had pitched himself into loaded bases and two out in the seventh. Statistics didn't back the move, however. The right-handed-hitting Renteria this season has hit righties (.263) better than lefties (.248), and Renteria entered 3-for-9 with a previous grand slam against Betancourt and 0-for-1 against Morales.

However, Tracy noted that it was simply time to go to Betancourt, who has been mostly spectacular since joining the Rockies.

"The number of pitches that Franklin had thrown [38], the fact that Rafael Betancourt had gotten anybody and everybody out ... he made a bad pitch," Tracy said. "You're to the guy that has gotten you to this point since the trade. It's that simple.

"I'd have felt a lot worse if I'd allowed Franklin to go one more hitter with Edgar Renteria and he hits a grand slam off a left-handed pitcher when you know you've taxed him about as hard as you can tax a guy."

Betancourt said it was as simple as a poorly located pitch.

"I missed my spot, and when you do that, you'll pay," Betancourt said. "The pitch was supposed to be away, and I left it middle-in."

The Rockies scored four runs in six innings against Cain, who struck out eight but gave up consecutive homers to Helton and Tulowitzki in the fifth.

Tulowitzki's homer came with some strife.

While Tulowitzki was in the on-deck circle, he stopped to chide some teenagers who were razzing him. Tulowitzki said an adult was the ringleader, using "every cuss word in the book." Tulowitzki said he wanted to offer the teens another way.

"Anytime I came to a big league ballgame, I respected the players," said Tulowitzki, who said fans were throwing objects at him. "Not one time did I say anything other than, 'Could you sign this autograph?' or how good of a player I thought a guy was. There were definitely some inappropriate things being said."

After rounding the bases, Tulowitzki pointed to the teens, not to show them up, he said, but to reinforce his point. But "they were all over me after that."

Stewart tripled and scored on Clint Barmes' sacrifice fly in the sixth, and Tulowitzki added an RBI single off Brandon Medders (3-1) in the seventh. Medders, however, worked Brad Hawpe into an inning-ending double play.

Jeremy Affeldt, helped by Barmes' second poorly executed bunt in as many games, escaped first-and-third with one out in the eighth. When Hawpe misplayed Juan Uribe's single to right into three bases, the bottom of the eighth escaped the Rockies.

Almost forgotten was a solid start from Rockies right-hander Jason Hammel (five innings, four hits, two runs).