McNeil won a lefty-on-lefty matchup, pulling a 1-1 slider from Tanner Scott that was clocked at 89 mph.
It was the first earned run allowed by Scott (8-5) since July 31. Lefty batters were hitting just .163 against Scott entering Monday.
Miami (78-73) had its three-game win streak snapped, damaging its standing in the National League wild-card race. The Marlins slipped one game behind the Arizona Diamondbacks (79-72) and a half-game behind the Chicago Cubs (78-72) and the Cincinnati Reds (79-73) in the chase for the last two NL wild cards.
The Mets (70-80), who are out of contention, won their second straight game.
New York's Phil Bickford (5-5) pitched one inning of scoreless relief for the win. Adam Ottavino pitched a scoreless ninth to match his career high with 11 saves.
Miami's Luis Arraez, who leads the majors with a .354 batting average, went 2-for-4. He singled in the first inning for his 200th hit of the season.
Both starters pitched well but were left with no-decisions.
Mets rookie Jose Butto, making just his sixth major league start, tossed the best game of his young career. He allowed just four hits, one walk and one run in six innings while striking out six batters.
Miami's Edward Cabrera went 5 1/3 innings, permitting four hits, one walk and one run. He struck out four.
New York opened the scoring in the fifth thanks to efforts by two of its rookies. Ronny Mauricio singled and stole second to set up the rally. Mark Vientos, who grew up in South Florida, then lined a single to center, and Mauricio came flying around third base to score.
Miami tied the score in the bottom of the fifth. Jesus Sanchez drew a leadoff walk and raced to third on Garrett Hampson's bad-hop single that ate up Mauricio at third base. The ball hit the lip of the infield grass and bounced over Mauricio's glove. Sanchez subsequently scored when Joey Wendle bounced into a double play.
The Marlins seemed to take a 3-1 lead in the sixth when Arraez singled and Jorge Soler followed with a monster 428-foot homer over the left field foul pole. However, after a review, the call was overturned, with the ball ruled to be foul.
New York threatened in the eighth against reliever David Robertson, who started this season with the Mets. Brandon Nimmo and Francisco Lindor both hit one-out, opposite-field singles, but Robertson struck out DJ Stewart and Pete Alonso — both looking.
McNeil, however, provided the game-winner in the ninth.
—Field Level Media