Dodgers 5, Cubs 2 (12): Hanley Ramirez delivered a three-run walk-off homer among his three hits and Los Angeles outlasted visiting Chicago.Dee Gordon belted a two-out single off Blake Parker (1-1) and stole second before Justin Turner walked and Ramirez deposited his 12th home run into the Dodgers bullpen in left. Jamey Wright (4-2) worked two scoreless innings for the Dodgers, who have won seven of their last eight games to move 3 1/2 games ahead of San Francisco in the National League West.Arismendy Alcantara and Starlin Castro had three hits apiece for Chicago, which played extra innings for the third time in its last five games. The Cubs got on the board in the first as Chris Coghlan belted a one-out double and scored on Castro's single off Hyun-Jin Ryu, who allowed two runs on nine hits over seven innings. Matt Kemp put the Dodgers ahead in the fourth with his fourth homer in the last five games, a two-run blast off Tsuyoshi Wada following Ramirez's leadoff walk. Wada yielded two runs while striking out six over 5 2/3 innings in his third major league start.The Cubs pulled even in the seventh as Junior Lake reached on a bunt single and scored on Alcantara's double to right field. Anthony Rizzo singled to begin the eighth and the Cubs had two on and two out before J.P. Howell replaced Brandon League and struck out Luis Valbuena to end the inning.GAME NOTEBOOK: Los Angeles 1B Adrian Gonzalez (bruised right knee) and OF Yasiel Puig (mild left hamstring soreness) were both held out of the starting lineup for precautionary reasons, but each appeared as a pinch hitter late in the game. … Coghlan has reached base safely in 26 of his last 27 games. … The Dodgers recalled LHP Paco Rodriguez from Triple-A Albuquerque to replace LHP Paul Maholm, who will miss the rest of the season after suffering a torn ACL in Friday's series opener.