Nate Schierholtz hit a two-run homer in the fourth inning and San Francisco won 5-2 Monday night for its fourth win in five games since the All-Star break.
The Giants' 10th win in their last 12 games moved them past Colorado into second place in the NL West, four games behind idle San Diego.
The Dodgers have lost five in a row, including a four-game sweep at St. Louis, since the break and seven of their last 11. They dropped a season-high-tying six games behind the Padres.
"You get what you earn. Right now we've given a lot away and we have to find a way of getting back on track," manager Joe Torre said. "We've left a lot of men on base lately."
They dominated the Giants in the first half, winning five of six, including a three-game sweep last month in San Francisco.
But the Dodgers never got their offense untracked against Madison Bumgarner (3-2). The left-hander allowed two runs and six hits in 5 2/3 innings. He struck out three and walked two.
"It's pretty intense with the rivalry," Bumgarner said. "I wish I could've been a little more focused in the sixth. I definitely didn't make some pitches I needed to make."
All-Star Brian Wilson pitched the ninth and loaded the bases with two outs before striking out Casey Blake to earn his 26th save -- tied for tops in the NL -- in 28 chances.
"We've seen him quite a few times do that. It's part of Giants baseball," manager Bruce Bochy said. "It's not fun, believe me."
The Dodgers recalled James McDonald (0-1) from Triple-A Albuquerque before the game to make his first appearance this season. The right-hander gave up four runs and nine hits in five innings, struck out five and walked two.
"I thought he threw the ball good. But throwing the ball good isn't good enough if you don't locate it," Torre said.
McDonald escaped a no outs, bases-loaded jam in the second by retiring the bottom of the Giants' lineup in order.
But San Francisco came right back in the third, scoring two runs with two outs to take the lead.
Rookie Buster Posey extended his career-high hitting streak to 13 games with a RBI single that scored Andres Torres, who doubled to lead off. Pablo Sandoval followed with a RBI double that brought Posey home in time to beat the tag of Russell Martin.
"I trust my stuff, added a new pitch [slider], so I'm different," McDonald said. "You always feel butterflies when you go out there, but it's a different type of butterflies now -- more of a competing feeling than a nervous feeling. I got my adrenaline going in the second inning and got out of it. So that was fun."
The Giants took a 4-0 lead in the fourth on Schierholtz's third homer of the season that landed over the wall in right field. Their fifth run scored on Freddy Sanchez's sacrifice fly in the eighth, even though it appeared that Torres passed Edgar Renteria on the basepaths.
"We had some weird plays and I learned some things I didn't know," Posey said, citing how the final run scored. "I didn't think that run was scored."
The Dodgers trailed 4-2 in the sixth. All-Star Rafael Furcal, who came in hitting .545 against the Giants and had three hits in five at-bats, led off with his seventh homer into the Dodgers' bullpen in left field. Jamey Carroll scored the second run of the inning on a fielder's choice grounder by Matt Kemp, crossing the plate just before third baseman Sandoval tagged out James Loney.
"I didn't think he did [touch the plate]," Bochy said. "I had a pretty good view of it."
Los Angeles loaded the bases with two outs in the seventh, but Andre Ethier grounded out to first to end the inning.
Dodgers LF Manny Ramirez will have a MRI on Tuesday. Torre said the slugger felt tightness in his right calf when running Monday. Carroll made his first start in the outfield as a Dodger. ... The Giants recalled IF-OF Eugenio Velez from Triple-A Fresno and optioned RHP Joe Martinez to Fresno. ... Former Giants Hall of Fame announcer Lon Simmons turned 87 Monday.