Hanley Ramirez, who didn't start because of a hamstring injury, belted a pinch-hit, two-run homer in the seventh for the Marlins, who took the second contest of the four-game series and won for just the third time in 10 games.
Justin Miller (3-0) retired the final batter of the sixth inning to get the win. Kevin Gregg struck out the side in the ninth for his 16th save. Marlins starter Scott Olsen was lifted after giving up eight hits and four runs over 5 2/3 innings.
Khalil Greene belted a two-run homer for San Diego, which had won five of its last six games. Brian Giles walked twice and had a two-run single in a losing cause.