Miami won for the first time this season, building a 6-0 lead and holding on in the late innings.
The Marlins batted around in the seventh, an inning that began when Donovan Solano reached on an error by New York shortstop Miguel Tejada.
Alex Sanabia (1-0) worked six shutout innings to get the win, allowing six hits with three walks.
Daniel Murphy hit a three-run homer for the Mets in the seventh and New York eventually brought the tying run to the plate in the ninth before Steve Cishek got Justin Turner on a ground out to end the game.
Jeremy Hefner (0-1) allowed a run on five hits in six innings to take the loss. New York put at least one runner on base in each of the first six innings without scoring.
Miami was the last team in the majors to post a victory this year, having been swept in a three-game series by Washington to start the campaign.