SAN FRANCISCO -- Edgar Renteria believes San Francisco has a good shot to make the playoffs this season. The veteran shortstop is doing his part to get the Giants there.
"That's why I signed last year because I knew they had a lot of young guys and a lot of talent," said Renteria, whose homer was his first in nearly four months. "Last year it didn't work but this year we have a chance to do it, so we're not going to be sleeping. We're going to be ready."
The Giants pulled within 2 1/2 games of first-place San Diego in the NL West and maintained their 1 1/2-game lead over Cincinnati in the wild-card race.
They did it by outlasting Florida All-Star Josh Johnson then scoring three times off the Marlins' bullpen.
Uribe's home run was his 14th of the season and his second in four games. Renteria's was his first since April 9.
"That's a nice win ... especially who we were going against," San Francisco manager Bruce Bochy said. "We're going to see good pitching down the stretch and it's going to be important that we win some of these games. If we're going to be the club we think we are we're going to have to beat these guys, and tonight we did."
Buster Posey extended his major league-leading hit streak to 20 games, two shy of the Giants' franchise rookie record held by Willie McCovey, as San Francisco won for the 16th time in 20 games.
Dan Uggla homered twice for Florida, which lost for just the fifth time in 15 games.
"We had a good shot at winning this game," Marlins manager Edwin Rodriguez said. "We need to score some runs for [Johnson]. He kept us in the game. When he ran into problems he was able to control them."
Uribe, starting in place of Pablo Sandoval at third base, just missed a home run on the first pitch he saw from reliever Brian Sanches (0-2) before he belted a 1-2 pitch deep over the wall in left-center to break a 3-3 tie. Renteria followed three batters later with his second homer of the season despite Bochy calling for a hit-and-run.
"That's what I was trying to do," Renteria said. "But I have to be aggressive, and when you're aggressive, that happens."
Johnson had not allowed more than two runs in his previous 13 starts and was attempting to become the first pitcher since Houston's Mike Scott (1986) to run the streak to 14.
It didn't happen for the Marlins' All-Star. Johnson allowed three runs and eight hits, matching his season high.
"At times I found my rhythm and it would be good for two batters and then go away," Johnson said. "My pitches were decent but some just fell in. They got wood on them and put them in there. The other pitches were just horrible pitches."
Aubrey Huff hit an RBI-double in the third to drive in Andres Torres and later scored on Posey's single. Posey's streak is two shy of McCovey's rookie record set in 1959, and the longest by any Giant since Randy Winn had a 20-game streak in 2007.
The rookie catcher is hitting .456 with six homers and 23 RBIs during the streak.
"We're all into it now," Bochy said. "Since he's come up here he's been a shot in the arm for us. This won't be his only streak. This guy can hit."
Torres doubled with two outs in the fifth and scored on Freddy Sanchez's single to make it 3-2 but Uggla's solo home run off Cain tied the score.
San Francisco's Matt Cain scattered four hits and gave up three runs over seven innings but left with a no-decision for only the second time in his last 18 starts.
Uggla added his 21st home run of the season with two outs in the ninth off Wilson to cut it to 6-4. San Francisco's closer then struck out Wes Helms to end the game.
Johnson still leads the majors with a 1.72 ERA. ... Huff needs one hit to reach 1,500. ... Sandoval, who missed the past two games while attending to personal matters in Venezuela, arrived at the park less than two hours before the start of the game. He's expected to be in the lineup Wednesday. ... Sanchez returned to the No. 2 spot in the Giants' lineup after spending the last two games hitting eighth. ... Rodriguez said the team should know within five days whether injured OF Chris Coghlan will require surgery after tearing the meniscus in his left knee while celebrating the Marlins' win over Atlanta on Sunday. Coghlan, who was placed on the 15-day DL Tuesday, will meet with a doctor in Miami later this week. ... The Marlins made two other moves, designating minor league RHP Kris Harvey for assignment and releasing LHP Nate Robertson. ... George Davis holds the Giants franchise hitting streak record with 33 in 1893. ... Uggla has 142 home runs with the Marlins, one shy of the franchise record held by Mike Lowell.