Mets third baseman Todd Frazier celebrates with teammates after scoring...

Mets third baseman Todd Frazier celebrates with teammates after scoring during the second inning against the Marlins in Miami on Sunday. Credit: AP / Gaston De Cardenas

MIAMI — The first half of the Mets’ first season under manager Mickey Callaway hit the halfway point Sunday with a 5-2 win over the Marlins, saving them from what would have been a couple of particularly embarrassing feats.

Instead of getting swept by the rebuilding Marlins, the Mets (33-48) lost two out of three. And instead of being alone in last place in the National League after game No. 81, the Mets are second to last, one game ahead of Miami.

Through their struggles, though, the Mets have learned a lot, Callaway said.

“They’ve been tough. I’ve obviously learned a lot. We’ve learned a lot about each other,” Callaway said before Sunday’s game. “If we ultimately get to where we want to get, these times are going to be very valuable to reflect on and learn from. We’d rather be winning games. But what has already happened has happened. We’re going to learn from it, move forward and try to do the best we can to go win a game today and moving forward.”

What has Callaway, a first-time manager and former pitching coach, learned about managing in a half-season?

“Probably nothing more than what I thought coming in as far as managing,” he said.

Callaway noted that this is his first time on the coaching side dealing with prolonged team struggles. From 2013-17, when he was Cleveland’s pitching coach, the Indians never endured a losing season and went to the playoffs three times in five years. For all that Callaway learned from working under and with Terry Francona, this is one aspect of the game that is new to him.

His answer is to “stay the course,” Callaway said, and stick to his principles: Bring energy every day, don’t deviate in demeanor, put in the work and the results will come.

“I’m learning a little bit about that and what it takes to deal with that,” Callaway said. “It’s something that you can’t be prepared for. This is a stretch that not many teams go through. You just have to keep on plugging along.”

For a day, the Mets returned to their early-season script. Asdrubal Cabrera homered — his team-high 14th, matching his 2017 total — and scored twice. Todd Frazier had two hits, including a double, and scored three times. Jeurys Familia got the drama-free save with his first perfect inning since May 28.

Steven Matz held the Marlins to an unearned run — scored on his own fielding error — in 5 1⁄3 innings. He struck out six, walked two and allowed three hits, struggling with a high pitch count all afternoon due in part to three Mets errors.

Miami left six runners on base and went 0-for-4 with runners in scoring position against Matz. His greatest escape job was in the second, when he struck out Starlin Castro to strand three. The Mets helped the Marlins load the bases with Frazier’s error and Matz’s walks to Lewis Brinson and pitcher Dan Straily (seven innings, three runs).

The Mets framed their win as the potential start of something. They had the worst June in franchise history (5-21), but hey, they’re undefeated in July. “Hopefully that kick-starts us,” Frazier said. “I know I keep saying it. Everybody keeps saying it.”

Said Brandon Nimmo: “We’ve had some tough losses. We’re trying to turn it around, create a different chemistry, kind of forget what we’ve done and create a new path.”

Callaway is worried about his players becoming numb to all the losing. “You worry about that every day,” he said. “You come to the field, continue to work and try to make sure you put yourself in a good position. And then you continue to lose. It’s not acceptable.

“So we have to definitely monitor that and pay attention to it and make sure guys are motivated and continue to come here believing in themselves that they can get the job done.”

Notes & quotes: Dominic Smith (sore right wrist) will return to the lineup in Toronto, Callaway said. Smith received a cortisone shot and said his MRI on Wednesday was clean, but there seemed to be confusion about the severity of the issue. Callaway said it was “a day thing, he’s totally healthy, ready to go.” Smith cited it as a reason he hasn’t been starting . . . Nimmo is 1-for-18 since getting hit by a pitch on his right hand June 24. “I correlated those two events as well,” he said, insisting his hand feels fine. “I don’t know what the fix is right now. I’m searching for it heavily in the video.” . . . Noah Syndergaard (strained right index finger) and Jason Vargas (strained right calf) will throw their simulated game Tuesday . . . Jay Bruce (strained right hip) has been swinging inside and will take on-field batting practice Thursday, Callaway said.

SUBSCRIBE

Unlimited Digital AccessOnly 25¢for 5 months

ACT NOWSALE ENDS SOON | CANCEL ANYTIME