Dodgers newcomer Hanley Ramirez hit a two-run homer in the 10th inning and Los Angeles beat the San Francisco Giants 5-3 on Friday night in a matchup of the top two teams in the NL West.