Ricky Nolasco allowed one run in eight innings and the Marlins snapped a seven-game losing streak by beating the Giants 2-1.