Giancarlo Stanton hit his 34th home run and the Marlins scored three runs in the eighth inning to beat the Mets 9-6 on Monday.
''It was back and forth, a few different lead changes there, we kept pushing and that was the biggest key to finish it off,'' Stanton said.
Miami capitalized on some wildness by Mets reliever Jeurys Familia (2-4) in the eighth. Familia had two throwing errors and a wild pitch, leading to the three tiebreaking runs as the Marlins who snapped a five-game losing streak to the Mets.
''I just had a bad day,'' Familia said. ''I felt the same way I do every time out, I just had a bad day.''
Jarrod Saltalamacchia, who had doubled to open the inning, scored on Familia's wild pitch two batters later, giving the Marlins a 7-6 lead. Adeiny Hechavarria later scored on a fielder's choice with the bases loaded and Christian Yelich came in on a walk to Casey McGehee.
Marcell Ozuna and McGehee finished with two RBIs each for the Marlins, who used five relievers after starter Henderson Alvarez left in the third inning with a left oblique strain.
A.J. Ramos (6-0) pitched a scoreless eighth and Steve Cishek pitched the ninth for his 32nd save in 36 chances.
Dilson Herrera, a 20-year old second baseman who is the youngest player in the Majors and the only one to jump from Single-A to the big leagues, hit his first career home run and first career triple while driving in three runs for the Mets.
David Wright had two RBIs for New York.
The score was tied at 6-6 going into the eighth before the Mets committed three of their season-high six errors and walked three batters.
''It wasn't a big-league baseball game, I can tell you that,'' Mets manager Terry Collins said.
Alvarez battled through the injury in the first two innings, retiring the first six batters he faced before he was pulled in a rough third inning. Alvarez allowed a home run to Herrera to start the third and a base hit by Wright, which cleared the bases after Ozuna's wild throw home from center field ended up in the stands to give the Mets a 4-2 lead.
''I was frustrated, I was mad, I wanted to keep pitching,'' Alvarez said. ''I went out there with the pain and I was able to go through it, but sometimes you've got to give in to it. It was frustrating and a terrible feeling.''
Marlins manager Mike Redmond and a trainer came out to talk to Alvarez, who eventually slammed the ball into Redmond's hand when he left the mound.
''You kidding me? All the foul tips I've taken in my life, that was nothing,'' Redmond said. ''It felt like a feather.''
The Mets led 6-5 in sixth after Herrera's two-run triple, but the Marlins tied it in the bottom of the sixth on an RBI single by Yelich.
Mets' starter Zack Wheeler, who came into the game with a 6-1 record and 2.17 ERA over his last 11 starts, lasted just 4 2-3 innings while throwing 114 pitches. He struck out eight and allowed five hits and five runs - two earned.
''I felt terrible all day, honestly,'' Wheeler said. ''My breaking ball was up in the zone - nothing was really working for me.''
Marlins: Alvarez began feeling pain in his oblique during his last start on Aug. 27 at the Los Angeles Angels. He is listed as day-to-day and plans on returning to the mound this season. ''The plan is to keep doing my work, keep doing my training, get healthy, and finish the year off healthy and finish the year off strong,'' Alvarez said. ... RHP Bryan Morris (hip) plans to be available in the bullpen on Tuesday.
Marlins RHP Brad Penny (1-0, 5.40) will get the start against Mets LHP Jon Niese (7-10, 3.48) on Tuesday. Niese is 1-0 with a 1.42 ERA in three career starts at Marlins Park. Penny is 5-13 with a 6.25 ERA in his career against the Mets.
STANTON STRIKES EARLY
Stanton is tied with Toronto's Jose Bautista for the most first-inning home runs in the majors this season with 12.
HERRERA OFF TO A GOOD START
Herrera is the youngest Met to hit his first career home run since Jose Reyes did so on June 15, 2003, against the Angels at Anaheim, California.