Nolasco (3-0) allowed a solo home run to Pablo Sandoval, but it was the only run he surrendered over 7 1/3 innings.
Heath Bell set the Giants down in order in the ninth for his third save. Miami had lost eight of nine heading into the game.
Giancarlo Stanton had a solo home run of the Marlins and Hanley Ramirez recorded the other RBI.
Matt Cain (1-2) allowed both Florida runs on six hits over eight innings for the Giants.
McPhee, Cokas 'working on their marriage' after affair
Astronomers offer more expansive view of universe