LOS ANGELES -- Hanley Ramirez drilled his first career walk-off home run, lifting the Los Angeles Dodgers past the Chicago Cubs in extra innings.

Ramirez hit a three-run homer with two outs in the 12th inning, giving the Dodgers a 5-2 victory before 53,354 at Dodger Stadium on Saturday night.

Ramirez homered off Cubs reliever Blake Parker (1-1) as the Dodgers (63-48) captured their seventh win in eight games and defeated the Cubs (46-63) for the 10th time in the last 12 meetings.

"I think he just made a mistake," Ramirez said of Parker, who gave up the shortstop's 12th home run of the season. "He left something over the top of the plate and I made a good swing."

Ramirez said he kept a keen eye on Parker during the at-bat of Dodgers first baseman Justin Turner, who drew a walk before Ramirez came to the plate.

"I was watching the way they were pitching to J.T. and (he) acted like they didn't want to pitch to him," said Ramirez, who went 3-for-5 with a walk and a double. "I told myself 'you got to come through.'"

The Dodgers increased their National League West lead over the San Francisco Giants, who lost to the New York Mets on Saturday, to 3 1/2 games. The Dodgers are 16-6 at home since June 13.

"Two runs obviously kept us in the fight, but we weren't able to draw that last run," Cubs manager Rick Renteria said.

Dodgers center fielder Matt Kemp also hit his 12th home run in the win.

"That's what we're here for, to win games" Ramirez said. "That's what it's all about."

Second baseman Dee Gordon kept the 12th inning alive for the Dodgers with a two-out single. He took second on his major league-leading 51st stolen base despite not getting a good jump because of a light rain that fell. Turner followed with a walk.

"Guys played hard the whole game," Gordon said. "Our bullpen stepped up big and kept us in the game. Hanley is one of the best players in the league and for him to come through for us is amazing."

Cubs second baseman Arismendy Alcantara had lined a run-scoring double into the gap in right center field to score Junior Lake to forge a 2-2 tie with two outs in the seventh inning. It stayed that way until Ramirez's winning blast.

"We've played a lot of extra innings ballgames," Renteria said. "We had some opportunities to cash in some runs again today. We just weren't able to do it."

Los Angeles left-hander Hyun-Jin Ryu struck out six, giving up two runs and scattering nine hits with a walk in seven innings. He did not factor into the decision, though.

Relievers Brandon League, J.P. Howell, Kenley Jansen and Brian Wilson, who struck out all three batters in the 10th, combined to pitch three scoreless innings for the Dodgers. Jamey Wright (4-2) added two innings of scoreless relief.

Chicago starter Tsuyoshi Wada, who made his fourth career start, allowed two runs and six hits with six strikeouts and two walks (one intentional) in 5 2/3 innings. Wada was facing the Dodgers for the first time.

"He did a nice job," Renteria said. "Worked through some traffic, but minimized damage. I mean two runs are pretty good. Nice outing for him. He worked pretty good."

Relievers Carlos Villanueva, Brian Schlitter, Pedro Strop, Wesley Wright and Justin Grimm kept the Dodgers quiet until the 12th inning.

Shortstop Starlin Castro's RBI single with two outs in the first inning drove home left fielder Chris Coghlan, who doubled, for a 1-0 Cubs lead.

After a walk to shortstop Hanley Ramirez, Kemp stroked a two-run blast to left off Wada with no outs in the fourth inning for a 2-1 Los Angeles lead.

NOTES: Dodgers LHP Paul Maholm suffered a torn ACL in his right knee during Friday night's loss and probably will miss the rest of the season. LHP Paco Rodriguez was recalled from Triple-A Albuquerque to fill Maholm's roster spot. ... Los Angeles 1B Adrian Gonzalez and RF Yasiel Puig were not in the starting lineup, but made pinch-hitting appearances late in the game. Both suffered minor injuries in Friday's loss. ... Chicago 1B Anthony Rizzo was batting .387 with three home runs and five RBIs against left-handed pitching since July 8 entering Saturday's game. ... Cubs RHP Edwin Jackson (5-11, 5.79 ERA) will face Dodgers RHP Josh Beckett (6-5, 2.74 ERA) in the series finale Sunday.