Los Angeles’ Matt Kemp watches his two-run home run during Sunday’s game against the San Francisco Giants in Los Angeles.

LOS ANGELES — Matt Kemp apparently has regained the home run stoke that made him runner-up in the MVP race three seasons ago. Now it’s just a matter of staying healthy and retaining his everyday job in center field for the Los Angeles Dodgers.

Kemp hit his first two home runs at Dodger Stadium since late in 2012, helping Los Angeles beat the San Francisco Giants 6-2 Sunday night to avoid a three-game sweep.

“It always feels good to hit home runs here in Dodger Stadium, especially with the home crowd,” Kemp said. “It has been a while, so I was pretty excited to do that. It can be tough to hit home runs here at times, but it looked like the ball was carrying a little bit tonight.”

Hanley Ramirez also slugged his first two homers of the season in support of Zack Greinke (2-0). The right-hander pitched six innings, allowing two runs and six hits — including Brandon Belt’s fourth homer leading off the sixth, and the first of the season by Hunter Pence three batters later. Greinke struck out eight and walked none.

Matt Cain (0-1) gave up five runs and six hits in six innings with three strikeouts and no walks. It was the eighth time the right-hander has surrendered three or more homers in a game during his 10-year career, and the first time since May 16, 2013 at Colorado in an 8-6 win. The Dodgers’ last run off him came on Andre Ethier’s sacrifice fly in the sixth.

Kemp, who hit a career-high 39 home runs in 2011, entered Sunday with two homers and three RBIs in 54 career at-bats against Cain.

“I made three really big mistakes to guys who can drive the ball well. That’s what ended up changing the game and that’s what ended up costing us,” Cain said. “I don’t want to nibble and I don’t want to go away from the strike zone. I’m going to try to attack guys. Obviously, you want to keep the ball in the park, but I’ve always been a guy that can elevate the ball. But sometimes when it’s elevated to certain guys and you leave in certain areas, it’s prone to go out.”

Cain, who gave up a career-worst 23 home runs last season, threw Kemp a 1-0 pitch that ended up in the pavilion seats in left-center with two out in the second. It ended the two-time All-Star’s homerless drought of 140 at-bats at Chavez Ravine since his go-ahead two-run shot off Colorado’s Jorge De La Rosa on Sept. 30, 2012.

Kemp did it again his next time up, this time to right-center on an 0-1 delivery after a double by Adrian Gonzalez. It was his sixth career multihomer game and first since Sept. 29, 2012.

“Cain’s a tough pitcher and he throws a lot of different pitches,” Kemp said. “So I was just looking to get a ball over the plate, and he gave me a couple of them over the plate and I put some good swings on them and did what I needed to do. My second home run, that’s when I know I’m seeing the ball good. When I’m driving the ball to right field.”

Kemp was activated from the disabled list on Friday, after injuries limited him to 73 games last season and forced him to undergo surgery on his is left ankle and shoulder.

Manager Don Mattingly chose not to start Kemp in the series opener, but reversed his decision after benching right fielder Yasiel Puig for arriving late to the ballpark.

Puig didn’t play Sunday, either. This time it was because of a swollen left thumb, which occurred on Saturday when he made a headfirst slide into first base on an infield hit. Puig finished that game, then left the ballpark earlier Sunday to get an MRI exam before rejoining his teammates in the dugout before the start of this one.

Ramirez homered to center field in the eighth against David Huff, capping his 15th career multihomer game.

Giants center fielder Angel Pagan singled his first two times up for San Francisco’s only hits through the first four innings — and robbed Greinke of an extra-base hit in the third with a diving catch in left-center.

Greinke got his first hit of the season his next time up, however, driving a ground-rule double to left-center in the fifth.

NOTES: The Giants begin their home schedule Tuesday night, with Tim Hudson making his official debut with the team against Arizona’s Trevor Cahill. ... Mattingly has decided to back off on LHP Hyun-Jim Ryu and give him an extra day’s rest after he started three of the team’s first six games due to Clayton Kershaw’s first career stint on the disabled list. ... Dodgers RHP Josh Beckett, whose season debut has been delayed by calf and ankle issues after he underwent thoracic outlet syndrome surgery last year, threw a bullpen session Sunday and could start Wednesday’s interleague game against Detroit.