They had a plan. Really, a pretty good one. Trouble was, the Dodgers could never get their eight guys with healthy limbs together at the same time.

The Dodgers finally got a look at their plan -- or at least one with Yasiel Puig subbing for Carl Crawford -- Tuesday, and it made them happy.

With Matt Kemp back in the lineup and Hanley Ramirez continuing to hurt baseballs, the Dodgers downed the Giants, 6-5, in a nervous little affair in front of 47,192 at Dodger Stadium.

It added up to their fourth consecutive victory, a little feat they had failed to accomplish all season. Their timing continued to be pretty decent, too, with every other team in the National League West losing.

Ramirez was two for four, including a rocket shot off the left-field foul pole. The drive went almost halfway up the pole, ricocheting almost violently off into the left-field stands.

In his last eight games, Ramirez is 14 for 30 (.467) with four home runs and 10 RBIs.

Ramirez has had a definite impact on the lineup since returning from a strained hamstring, and now the Dodgers are hoping Kemp can follow his lead.

Somewhat surprisingly, Kemp was activated off the disabled list prior to the game after appearing in only three rehab games. He last played nearly a month ago, injuring his hamstring May 29.

Kemp was one for four. But showing a taste for the dramatics, he made a game-saving catch for the final out to kill a San Francisco rally.

The Giants had scored twice in the ninth inning to pull within one run and had runners at first and second with two outs when Marco Scutaro lined a drive over Kemp's head in center field.

But Kemp, showing no effects from his hamstring injury, sprinted almost straight back to make a lunging catch on the warning track. Kemp smacked the center-field wall in celebration.

Still, a lineup that had featured Puig, Adrian Gonzalez, Ramirez, Kemp and Andre Ethier as its 2-6 hitters was more impressive than anything the Dodgers had offered all season.