James Loney had two RBIs, and the offensively challenged Los Angeles Dodgers parlayed three errors by the New York Mets into six unearned runs to help Clayton Kershaw win 8-3 on Sunday night.

Kershaw (6-4) allowed three runs — one earned — and five hits over seven innings with nine strikeouts and three walks. Last year's NL Cy Young winner, named to the All-Star team for the second straight season just hours before taking the mound, overcame a pair of costly errors by shortstop Dee Gordon in the third and improved his career record against the Mets to 5-0 with a 1.37 ERA in six starts.

The victory snapped a season-worst seven-game losing streak by the Dodgers, who avoided what would have been the Mets' first four-game sweep against them. New York didn't get another baserunner after Ruben Tejada's leadoff single in the fifth.

Dillon Gee (5-7) was charged with four runs — two earned — and five hits over six innings and struck out four. In his only other start at Dodger Stadium, the right-hander also was matched up against Kershaw and lost 6-0 on July 7, 2011.

Mets manager Terry Collins rested first baseman Ike Davis and second baseman Daniel Murphy in order to stack his lineup with all right-handed bats against Kershaw. But the plan backfired in the fifth, when the Dodgers capitalized on two errors by the right side of the infield into a pair of unearned runs that tied the score at 3 — without the benefit of a hit.

Ronny Cedeno, starting at second base for only the sixth time this season, dropped a simple throw from third baseman David Wright on a potential double-play grounder by Tony Gwynn Jr. after a leadoff walk to Juan Uribe.

Kershaw advanced both runners with a sacrifice bunt, and Uribe scored when Gordon's grounder was misplayed by Justin Turner in his third start at first base. A.J. Ellis followed with a sacrifice fly.

Juan Rivera drew a leadoff walk in the sixth, advanced on Adam Kennedy's ground-rule double and came home with the go-ahead run on Loney's grounder to second base — just his second RBI in a span of 39 at-bats.

The Dodgers blew it open with four runs in the seventh, after loading the bases with no outs. Rivera hit a comebacker to Miguel Batista, who tried to start a 1-2-3 double play, but catcher Mike Nickeas mishandled the throw for the Mets' NL-worst 63rd error as two runs scored. Kennedy followed with a sacrifice fly, and Loney made it 8-3 with an RBI double.

After getting shut out in five of their previous six games and getting outscored 30-2 during that stretch, the Dodgers ended a string of 23 consecutive scoreless innings with a two-out RBI double in the first by Rivera that tied the score after the Mets got an RBI single from Scott Hairston.

Rivera drove a 1-2 pitch over the head of right fielder Lucas Duda, and the ball landed on the warning track. The hit scored Ellis, who doubled for his first extra-base hit in 20 games and 58 at-bats since his two-run homer off Alex White on June 3 at Colorado. It was only the second time since June 15 that Dodgers had two extra-base hits in the same inning.

New York regained the lead in the third, parlaying two throwing errors by shortstop Gordon on back-to-back plays into a pair of unearned runs. The first miscue came on Wright's potential inning-ending double play grounder to second, as Gordon's relay to first ended up in the Mets' dugout — allowing Gee to score after he drew a leadoff walk.

Gordon then ranged to his left to field Hairston's grounder and bounced his throw to Loney, who grabbed the ball in midair after it glanced off his glove and turned around to show umpire Brian Gorman that he had possession. But Hairston was already across the bag, and by the time Loney realized that Wright was coming home, Loney's belated throw arrived a step too late.

NOTES: Kershaw has pitched at least five innings and allowed no more than two earned runs in 87 of his 133 career starts, and is 48-11 with 28 no-decisions in those games. Last season, he was 21-0 in 24 starts under those circumstances — but only 5-3 with two no-decisions this year. ... Wright finished second in the All-Star fan balloting at 3B — a whopping 1,610,162 votes behind San Francisco's Pablo Sandoval. But he will make his sixth appearance in seven years as a result of player balloting. ... Mets RHP R.A. Dickey, who leads the majors with 12 wins, also was added to the NL squad by manager Tony La Russa. ... Dodgers injured CF Matt Kemp was voted in by the fans as the NL's third starting outfielder, but won't be able to play because of his hamstring injury. ... Two former Dodgers were voted in by the fans to start in the All-Star game: 3B Adrian Beltre (Texas) and SS Rafael Furcal (St. Louis).