LOS ANGELES (AP) — The Dodgers were held in check by Milwaukee's Jimmy Nelson until they got a huge break and made the most if it, which is what first-place teams generally do.

Pinch-hitter Andre Ethier had a tying two-run single in the seventh inning, rookie Joc Pederson drove in the go-ahead run moments later with a double, and the NL West leaders beat the Brewers 3-2 Friday night.

Nelson (6-9) took a 2-0 lead and a two-hitter into the seventh inning. Hernan Perez, who replaced Aramis Ramirez at third at the start of the inning, booted a two-out grounder by Alex Guerrero, and Jimmy Rollins singled to put runners at the corners.

"I don't think anyone really realized at the time what the error meant, but definitely you could feel that it was maybe our break," Ethier said.

Rollins stole second, and Ethier followed with his broken-bat single to center on a 2-2 breaking ball while batting for reliever Chin-hui Tsao (1-0).

"We didn't do a great job of waiting out the right pitch to hit early in the game," Ethier said. "But we finally got a little break there with that error, and Jimmy came up with a big hit that propelled us to get away with three runs in that inning."

Pederson followed with an opposite-field drive into the left field corner to bring home Ethier.

"There were two outs, so I still had a chance to get out of that with no runs. That's why I'm being pretty hard on myself right now," Nelson said. "There's no excuse for me not getting one of the next two guys, so I feel bad about that part."

No one in the Brewers' clubhouse felt worse than Perez, who has been used as a late-inning defensive replacement by manager Craig Counsell on a regular basis for the past month.

"I tried to get the ball from my glove to my bare hand, but I missed the grip and I didn't have it," Perez said. "I feel bad about it because Jimmy threw a great game, but that's part of baseball. I hope I get an opportunity to make that play."

Tsao earned his first victory as a Dodger with a scoreless seventh. J.P. Howell pitched the eighth and Kenley Jansen got three outs for his 15th save in 16 attempts.

Dodgers starter Mike Bolsinger allowed two runs and four hits in six innings and struck out six before he was lifted for a pinch-hitter with a 2-0 deficit. It was the first time the right-hander went six innings since his last victory on June 8 against Arizona. In six starts since then, he is 0-3 with a 4.55 ERA.

The Brewers opened the scoring in the fifth with two runs that ended a string of 24 consecutive scoreless innings by the Dodgers' pitching staff.

Jean Segura and Scooter Gennett opened the inning with singles, and both runners advanced on the first of two wild pitches that inning by Bolsinger. Segura scored on Gerardo Parra's groundout and Gennett came home on another pitch in the dirt that deflected off Yasmani Grandal.

The Dodgers threatened in the bottom of the fifth when Grandal was hit by a pitch, stole second and continued to third on Jonathan Lucroy's throwing error. But Nelson struck out Guerrero and got Rollins on a flyball to center field.

Nelson walked Grandal and Yasiel Puig with one out in the second, then got behind Guerrero 2-0 and got a visit from pitching coach Rick Kranitz before Guerrero grounded into a double play on a 3-1 sinker.

"I'm primarily a sinkerball guy, so we knew in that situation I was one pitch away from getting out of the inning," Nelson said. "I stuck to my strength and just tried to force contact."

The Dodgers didn't get their first hit until Pederson lined a clean single to right field with one out in the sixth. Howie Kendrick followed with a bouncing single off Nelson's glove and Justin Turner grounded into a force at second before Adrian Gonzalez flied out to right field.

Pederson, heading to his first All-Star game, next week despite an NL-worst 104 strikeouts, fanned his first two times up against Nelson — slamming his bat in frustration on the second one after a swing and a miss. He is batting .177 with three solo homers, eight RBIs and 40 Ks in 109 at-bats.

KERSHAW SNUBBED AGAIN

Unless he gets added to the NL All-Star roster at the last minute because of an injury to someone, Kershaw will sit this one out after making the team in each of the previous four years. The reigning MVP and three-time Cy Young winner finished third in the internet voting for the final roster spot behind Cardinals RHP Carlos Martinez and Reds RHP Johnny Cueto.

"I thought I deserved to be there, but it didn't work out," Kershaw said. "You always want to go to All-Star Game so, yeah, there's a little disappointment there."

UP NEXT

Brewers: Rookie RHP Taylor Jungmann (3-1) will make his seventh career start after going 2-0 with a 2.52 ERA in his previous four.

Dodgers: RHP Brandon Beachy will make his first start and appearance in the majors since Aug. 20, 2013, after undergoing Tommy John surgery for the second time on March 21, 2014. He made his 46 previous big league starts with the Atlanta Braves from 2010 through 2013 before signing with Los Angeles as a free agent in February.