Garrett Cooper and Brian Anderson homered for Miami, which had dropped four in a row prior to traveling to New York for the makeup of a game postponed last Thursday, when the Mets and Marlins took the field for 42 seconds of silence before walking off in a protest of racial injustice.
Miami was outscored 18-7 while being swept over the weekend by the Tampa Bay Rays.
''We haven't been great lately, especially at home,'' manager Don Mattingly said. ''But we've hung in there. This trip is like a last straw-type thing. That was a sore spot. It could lead to a lot of complaining. But it was one of those things we had to get past.''
''To do it in this fashion is a really good feeling for our team.''
Miami also was active at the trade deadline, announcing a pair of moves. Outfielder Starling Marte was acquired in a deal with Arizona for pitchers Caleb Smith and Humberto Mejia and a player to be named. Jonathan Villar was traded to Toronto for a player to be named.
Villar started Monday's game at second base and made a diving catch in shallow center to rob the Mets of a run in the fifth. He was replaced by a pinch hitter in the sixth.
Robinson Cano homered and Jeff McNeil had two hits and an RBI for the Mets, who lost their fourth consecutive game. But reinforcements are on the way.
In separate trades with Texas, the Mets acquired catcher Robinson Chirinos for cash considerations and a player to be named, and got infielder Todd Frazier back for a player to be named. They also picked up reliever Miguel Castro from Baltimore in exchange for minor league pitcher Kevin Smith and a player to be named or cash considerations.
Frazier played for New York each of the previous two seasons, hitting .251 with 21 homers and 67 RBIs last year.
DeGrom, the two-time defending NL Cy Young Award winner, carried a two-hit shutout into the sixth. Cooper then got Miami on the board with a leadoff drive, and Matt Joyce reached on an error by first baseman Pete Alonso.
Joyce scored the tying run on Lewin Diaz's one-out double, and Rojas' two-out single brought home Diaz. Jorge Alfaro followed with an RBI double.
''I had a good feel for everything early on,'' deGrom said. ''Cooper there, threw a bad slider and then just wasn't able to execute when I needed to.''
Only one of the four runs charged to deGrom (2-1) was earned. The right-hander hadn't allowed four runs in an inning since he gave up five runs in the second against Milwaukee on April 26, 2019. He actually lowered his ERA from 1.80 to 1.76.
DeGrom faced the Marlins for the fourth straight start - the first time a pitcher has faced the same opponent four consecutive times since the New York Giants' Freddie Fitzsimmons did so against the Cincinnati Reds in 1929. He allowed seven runs over 24 innings for the Mets, who won the first three games.
''His stuff is always good, even when it's not picture perfect,'' Mattingly said. ''It's just a handful every time. You don't catch him on a bad day very often.''
Anderson hit a leadoff drive in the eighth for the Marlins, who stole four bases in five attempts.
''This is huge,'' Cooper said. ''I don't think many people wanted to do this trip, but we sucked it up and got a win.''
Trevor Rogers (1-0) pitched five effective innings for his first major league win. He allowed five hits, struck out five and walked two in his second career start.
Brandon Kintzler worked around a leadoff single for Andres Gimenez in the ninth to earn his seventh save.
The Mets scored both runs against Rogers in the third. Amed Rosario and Brandon Nimmo started the inning with a pair of walks. It was the first walk in 101 plate appearances this season for Rosario, who scored on McNeil's double. Nimmo trotted home on Dominic Smith's sacrifice fly
HELLO AGAIN HUNTER
Mets right-hander Hunter Strickland was recalled from the team's alternate training site prior to the game and tossed a scoreless seventh inning. It is the second Mets stint of the season for Strickland, who made the opening-day roster, but was designated for assignment on July 30 and outrighted to the alternate site on Aug. 3.
Marlins: 1B Jesus Aguilar (back) did not travel with the team for the makeup game. He has missed the last four games.
Mets: INF/OF J.D. Davis (left hip) didn't play after exiting the second game of Sunday's doubleheader against the Yankees in the seventh inning. Manager Luis Rojas said Davis was still feeling the effects of being hit in the hip by an Aroldis Chapman fastball on Saturday. ... LHP Steven Matz (shoulder) and RHP Dellin Betances (lat) each saw team doctors Monday. General manager Brodie Van Wagenen said he hoped both could return when first eligible to come off the IL or shortly thereafter.
Marlins: RHP Elieser Hernandez (1-0, 3.04 ERA) is scheduled to start Tuesday night against the Blue Jays in the opener of a two-game set.
Mets: Rojas said he doesn't know who will start the opener of a two-game series in Baltimore on Tuesday night - or Thursday's makeup game against the Yankees at Citi Field.
More AP MLB: https://apnews.com/MLB and https://twitter.com/AP-Sports
Copyright 2020 STATS LLC and Associated Press. Any commercial use or distribution without the express written consent of STATS LLC and Associated Press is strictly prohibited.