SAN FRANCISCO -- Earning his first career win against the Los Angeles Dodgers was a big step for San Francisco pitcher Matt Cain. Sweeping a three-game series from the Giants' division rivals was even more critical.
It wasn't difficult to tell which meant more to the right-hander.
Cain and two relievers combined on a four-hit shutout, Edgar Renteria hit a two-run triple in the sixth and the Giants beat the Dodgers 2-0 Sunday night.
"It's definitely nice so now you guys can't talk about it, but this was a huge win for us to take three from these guys," said Cain, who had seven strikeouts and one walk. "It's obviously been a problem beating these guys ... but we needed to do it as a group, and that's what happened today."
It's the Giants' first sweep of the Dodgers since April 24-26, 2007, and their first at home since 2004.
The timing couldn't have been better. San Francisco maintained its two-game lead over Cincinnati in the wild-card race and stayed 1 1/2 games back of the Padres.
"You're at the stage now where every win is big," Giants manager Bruce Bochy said. "We'll be talking about this quite a bit ... but if we're going to get this accomplished we need to play better against our division. It's big to get it today."
Cain was the first pitcher in San Francisco history to lose his first eight decisions against the Dodgers, including a 4-2 setback on June 29 when he allowed four runs in five innings.
Cain (9-8) was much better this time around, facing four batters over the minimum before giving way to the bullpen. He allowed just four singles while throwing a season-high 124 pitches and the Dodgers only managed to get one runner to third base
The Giants right-hander improved to 3-0 with a 1.52 ERA in his last four starts.
"I know he's glad to put this behind him and finally get a win against them," Bochy said. "He's thrown some good games and we've had trouble scoring runs for him. It was going the same way today but Edgar had the big hit for us."
Renteria hit a two-run triple in the sixth for San Francisco, which has won eight of its last 10.
The Dodgers, who made three trades in the final four days before Saturday's deadline, were shut out for the 11th time this season. They scored two runs over the final 18 innings of the series and dropped eight games behind first-place San Diego in the NL West.
"I know we're better and I know it's going to turn around," manager Joe Torre said. "The only question is when is it going to happen? We need for it to happen sooner than later ... because unless we play better, we are going to be where we deserve to be."
The Dodgers' best chance to snap out of their scoring slump came in the fourth when Scott Podsednik led off with an infield single, stole second and took third on a groundout. He was stranded when Cain retired Dodgers newcomer Ryan Theriot on a comebacker and got Rafael Furcal to fly out.
Lopez, acquired from Pittsburgh on Saturday, got the ball to Wilson, who struck out two in his first game since he was hampered by back spasms Wednesday.
Clayton Kershaw (10-6) allowed six hits in seven innings for the Dodgers.
His lone mistake came in the sixth after Pat Burrell hit a one-out double and Aaron Rowand was intentionally walked. Renteria hit a 1-0 pitch into the gap in left-center and center fielder Matt Kemp appeared to momentarily lose sight of ball in the early evening shadows, allowing it to roll to the fence as both runners scored.
"I had one pitch that someone did something with," Kershaw said. "I'm not worried about our hitting. I'm here to put zeros up there. [Cain] just put one more zero up there than I did."
Kershaw had allowed only three runs in 13 previous innings against the Giants this season.
The Dodgers finished 1-5 on their six-game road trip.
LHP Ted Lilly will make his Dodgers debut Tuesday in Los Angeles against San Diego. Lilly, who was drafted by the Dodgers in 1996, was acquired from the Chicago Cubs before the trade deadline. ... Dodgers SS Rafael Furcal batted third for the first time this season after hitting in the leadoff spot most of the year. ... Renteria's triple was the 28th of his career. ... All three games of the series sold out and drew 128,651 fans total, the largest attendance for a three-game set at AT&T Park this season. ... Nine of the Giants' 10 runs in the series came with two outs. ... Theriot went hitless in four at-bats with two strikeouts in his first game with Los Angeles.