LOS ANGELES -- Despite another erratic start by Brandon McCarthy, the Los Angeles Dodgers used their offense to recover in a win over the Pittsburgh Pirates on Saturday.

Joc Pederson homered and helped key a 17-hit attack as the Dodgers rallied past the Pirates 8-4 before an announced crowd of 40,563 at Dodger Stadium.

Pederson, who went 3-for-5 with two RBIs, was one of seven Dodgers with at least two hits. His two-run homer to left field in the sixth inning off reliever Jared Hughes was his 17th of the season. Corey Seager was 3-for-5 with an RBI for his fifth multi-hit game in a row. Chase Utley, Josh Reddick, Adrian Gonzalez, Howie Kendrick and Rob Segedin each had two hits.

"We're just grinding as a team, putting together quality at-bats," said Pederson, who fell a triple shy of hitting for the cycle. "We've been hitting balls hard for awhile now and it was nice to get a game where everyone kind of benefited from it."

Julio Urias (2-2) worked 2 2/3 scoreless innings in relief, striking out three, walking three and giving up three hits.

Closer Kenley Jansen struck out Gregory Polanco for his 35th save of the season.

McCarthy lasted only 1 2/3 innings and allowed three runs, two hits and a career-tying five walks with three strikeouts. He also hit a batter. McCarthy, who made his eighth start since coming off Tommy John surgery in April 2015, departed with right hip stiffness.

"I need some time off," said McCarthy, who walked five batters for his third straight outing. "I need to get my body where I need it. Mentallly, physically, everything needs to be in line. There's enough stuff coming back just from surgery. Adding new layers of stuff isn't helpful."

The Dodgers walked 11 batters.

Pittsburgh's Gerritt Cole (7-8) surrendered six runs (four earned) and 12 hits with three strikeouts and no walks in 4 1/3 innings.

"I just thought they capitalized on mistakes," said Cole, who tied a career high for losses in a season. "They found holes and they were able to going and moving on us."

Jung Ho Kang hit a solo home run for the Pirates (58-56), who lost for only the fifth time in their last 19 games against the Dodgers.

The Pirates left 18 runners on base, tying a franchise record. The last time it occurred was June 5, 1951.

"They were out there; we couldn't get them in," Pirates manager Clint Hurdle said.

McCarthy issued a bases-loaded walk to John Jaso for a 1-0 Pirates edge in the first.

The Dodgers tied it in the bottom of the inning as Utley came home when Seager grounded into a double play.

However, the Pirates regained the lead in the second when McCarthy walked Polanco with the bases loaded for a 2-1 advantage. That spelled the end for McCarthy, who was relieved by Josh Fields.

Fields served up an RBI single to Kang for a 3-1 Pittsburgh lead.

In the bottom of the second, Utley's run-scoring double sliced the gap to 3-2.

The Dodgers got a break in the third. An umpire's review overturned Pederson bouncing into a double play after it was determined that Pirates second baseman Adam Frazier failed to touch the bag. It allowed Gonzalez, who was initially called out, to remain at second. Gonzalez scored on a throwing error by Kang, knotting the score at 3.

Seager's single scored Reddick to put the Dodgers up 4-3. They added two more runs in the fifth on an RBI double by Kendrick and a squeeze bunt by Urias scored Kendrick.

"The offense has been swinging the bats really well, the bullpen's doing really well and we're playing good baseball, so we just need to keep building on that," Pederson said.

NOTES: Dodgers LHP Rich Hill will pitch a rehab assignment on Monday at Triple-A Oklahoma City. Hill, who is on the 15-day disabled list because of blisters on his middle pitching finger, has not pitched since the Dodgers acquired him from the Oakland Athletics at the trading deadline. ... Dodgers RHP Bud Norris (mild mid-back strain) is expected to throw about 75 pitches in a rehab start Saturday at Class A Rancho Cucamonga. Norris could rejoin the Dodgers sometime next week. ... Pirates C Francisco Cervelli (left wrist discomfort), who went 3-for-4 with a walk, returned to the lineup after missing the last two games. ... Pittsburgh C Chris Stewart went 1-for-2 with an RBI and a walk in a rehab assignment on Friday night with Double-A Altoona. ... Pirates RHP Chad Kuhl (2-0, 3.91 ERA) will oppose Dodgers LHP Brett Anderson (season debut) in the series finale on Sunday.