Capuano (11-8) broke a personal three-start losing streak with the gem, during which he surrendered just two hits and didn't allow a runner to get as far as second base.
The left-hander struck out 10 and worked around three walks as the Dodgers took the rubber match of a three-game series.
Ramirez, who was traded from the Marlins to the Dodgers last month after starring in Miami for six years, hit a sacrifice fly in the third inning for a 1-0 Los Angeles lead and later made it 3-0 with a two-run single in the eighth.
Andre Ethier and Luis Cruz also knocked in runs for the second-place Dodgers, who came into the contest trailing National League West-leading San Francisco by one game.
Miami's Wade LeBlanc (1-2) took the loss despite pitching well, yielding one run on six hits over seven frames.