Stanton connected in the eighth inning for his 30th home run since the All-Star break. The Marlins have 10 games left.
Stanton also hit a run-scoring single and has 120 RBI. He made a fine catch, too, against the right field fence to rob Asdrubal Cabrera.
A.J. Ellis and Miguel Rojas hit back-to-back homers off Mets reliever Erik Goeddel to start the eighth. With one out, Stanton pulled a 1-1 breaking pitch over the left field fence for a two-run homer.
Jose Urena (14-6) allowed two runs in eight innings. The Marlins finished the season 12-7 against the Mets and swept their NL East rivals for the first time since May 2014.
Rafael Montero (5-11) allowed five runs in four innings.