SAN FRANCISCO -- Yasiel Puig responded to getting hit by a pitch with a home run in his next at-bat, and Matt Kemp broke a tie with another solo shot one inning later as the Los Angeles Dodgers beat the San Francisco Giants 2-1 in the opener of a three-game series Tuesday night.
The win allowed the Dodgers (91-66) to keep pace with the Atlanta Braves (93-64) and the St. Louis Cardinals (93-65) in the battle among National League division winners for home-field advantage in the playoffs.
Hyun-Jin Ryu (14-7) won a pitchers' duel with Matt Cain (8-10), giving up a solo home run to Tony Abreu over seven innings.
In snapping a personal two-game losing streak in which he allowed only five runs, Ryu gave up only three hits -- all singles -- other than the home run. He struck out six and walked one.
Brian Wilson, making his first appearance for the Dodgers in San Francisco after he was last seen at AT&T Park as the Giants' closer, relieved Ryu to start the eighth and struck out two of the three men he faced in a scoreless inning.
Kenley Jansen worked around a one-out single by Buster Posey in the ninth, stranding the tying run in scoring position for his 28th save.
Cain, who entered the game with the sixth-best ERA since the All-Star break, began to demonstrate a vulnerability when he walked the bases loaded in the fourth inning. He walked just one batter in his previous two starts. Cain escaped the jam.
Puig's homer, 10 rows deep into the center field bleachers, was his 19th of the season and came on the first pitch he saw in the fifth inning. It also was Cain's first offering to the standout rookie since plunking him with a fastball in the third.
The hit-by-pitch was Puig's 11th of the season, the ninth most among all major-leaguers. He homered for the third time in a game in which he also gotten plunked.
The Giants got even on Abreu's second homer of the year in the bottom of the inning. However, the tie didn't survive the first batter of the sixth, as Kemp belted his sixth homer to left-center for a 2-1 Dodgers lead.
The home run was Kemp's first since July 21 against Washington, a stretch of 25 at-bats. He finished with two of the Dodgers' eight hits.
Carl Crawford had a double and two singles for the Dodgers, who out-hit the Giants 8-5.
The homers were the 22nd and 23rd allowed by Cain this season, a career-high.
He was pulled after seven innings, having limited the Dodgers to just the two runs on seven hits. It was his 12th consecutive start allowing three runs or fewer.
Cain walked three and struck out four.
The loss dropped the Giants under .500 at home this season at 38-39.
NOTES: The Dodgers began the three-game series as the only National League team with a winning record at San Francisco's AT&T Park (62-61). ... Dodgers OF Andre Ethier had to abort an attempted return to the lineup after experiencing recurring pain in his left ankle during a pregame workout. It's possible that Ethier, who hasn't started a game since Sept. 13, will not see any more action in the regular season. ... LHP Chris Capuano, out since Sept. 6 with a strained groin, kept his dream alive of making the Dodgers' postseason roster by making a pain-free, 41-pitch bullpen session before the game. ... The Giants opened their season-ending, six-game homestand needing four wins in order to avoid their first non-winning season at AT&T Park since 2008. ... San Francisco manager Bruce Bochy announced before the game that LHP Barry Zito, likely playing his final six games as a Giant this week, will start one of the club's three games against the San Diego Padres. It appears that will occur Saturday. ... The Giants shut down 2B Marco Scutaro (swollen left ring finger) for the rest of the season.