LOS ANGELES (AP) -- Clayton Kershaw outpitched a familiar foe for his first win in more than a month.
Kershaw was a bit better than Tim Lincecum in the seventh regular-season matchup between former Cy Young Award winners, rookie Yasiel Puig had three more hits and the Los Angeles Dodgers rallied to beat the San Francisco Giants 4-2 on Wednesday night for a three-game sweep of the defending World Series champions.
''I had better fastball command tonight than I had in the past,'' Kershaw said after his first victory in seven starts since May 20. ''There were a few three- or four-pitch sequences there where there was a lapse. So there's some little things to work on here and there. But overall, it was better tonight for sure.''
Kershaw (6-5) allowed two runs and four hits in eight-plus innings and had seven strikeouts against an offense that totaled just 14 runs over its previous six games while going 8 for 47 with runners in scoring position. The Giants' only runs came in the fourth on Buster Posey's 10th homer and second in two games, following a 14-game drought.
The left-hander, who led the NL in ERA each of the previous two seasons, has a 2.06 mark through his first 17 starts - tying Pittsburgh's Jeff Locke for second place, .01 behind the Mets' Matt Harvey.
When Kershaw won his Cy Young Award in 2011, he was 5-0 with a 1.07 ERA in six starts against the Giants that season - and four of those victories came in games that Lincecum was the opposing pitcher.
''Hopefully we keep pitching against each other for a long time,'' Kershaw said. ''But it's not a matter of facing him, but facing the eight other guys. And I'm sure he'd say the same thing.''
Kenley Jansen got three outs for his sixth save in eight attempts after Kershaw gave up a leadoff single in the ninth by Marco Scutaro. The right-hander retired pinch-hitter Brandon Belt on a broken-bat popup with runners at first and second to end it - opponents are 0 for 32 against him with men in scoring position.
''He came up with the tying run at the plate and went right through the heart of the order,'' Dodgers catcher A.J. Ellis said, ''so that was a big test for him.''
Lincecum (4-8) gave up four runs and 10 hits in 5 1-3 innings and struck out four. The two-time Cy Young winner is 1-7 with a 5.24 ERA in his last eight starts since beating Atlanta 5-1 on May 12 with seven innings of two-hit ball. The Giants have scored fewer than three runs in six of Lincecum's last eight outings.
''You kind of look forward to it, just because it make you rise to the occasion and pitch better,'' Lincecum said of facing Kershaw. ''I was more intent on being aggressive, but I just didn't put pitches where I needed to and when I should have.''
The Giants have lost four in a row and nine of 12, putting them a season-worst two games under .500 and dropping them into fourth place in the NL West. They are 3 1/2 games behind the division-leading Arizona Diamondbacks.
The Dodgers got the jump on Lincecum with an RBI single in the third inning by Hanley Ramirez.
But the Giants, who came in batting a league-best .285 against left-handed starters, responded in the fourth with Posey's 10th home run after a leadoff walk to Scutaro. It was first homer by last year's NL MVP in his first 40 career at-bats against Kershaw, and snapped a stretch of 30 consecutive innings in which the Giants hadn't held a lead.
''You can't walk Scutaro leading off that inning, especially after we just got a run,'' Kershaw said. ''I mean, Posey's going to hit homers - that's what he does - but it should have been a solo homer.''
That lead evaporated in the sixth, when the Dodgers pulled ahead to stay. Andre Ethier delivered the tying run with an RBI single and Ellis followed with a run-scoring double into the left field corner. Juan Uribe got an infield hit and Lincecum ended his night with a wild pitch to Skip Schumaker that allowed Ellis to score.
Lincecum got a break in the fifth on another overaggressive rookie mistake by Puig, who tried to stretch a two-out single into a double and was easily thrown out by left fielder Andres Torres. This was Puig's 13th multihit game and sixth with three hits since his big league debut June 3. He is batting. 435 in his first 22 contests.
NOTES: Dodgers CF Matt Kemp, who made a circus catch in the warning track to rob Scutaro of extra bases for the final out on Tuesday night in his first game off the disabled list, was not in the starting lineup but came in for defense on a double-switch in the ninth. ... Lincecum is 0-5 in six road starts since beating the Dodgers 5-3 on April 3 in his season debut. Barry Zito, 0-4 with an 11.28 ERA on the road, takes the ball for the opener of the Giants' three-game series at Colorado on Friday night. ... Kershaw has held the Giants to fewer than three runs in 17 of his l9 starts against them. ... The Giants were swept in a three-game set at Dodger Stadium for the first time since April 2009.