Brandon Nimmo of the Mets rounds to third base after...

Brandon Nimmo of the Mets rounds to third base after hitting a home run during the eighth inning against the Marlins at loanDepot park on Friday in Miami, Fla. Credit: Getty Images/Megan Briggs

MIAMI — Brandon Nimmo might be back.

He didn’t go anywhere, really, at least not physically, but a slump has a way of making a hitter seem — and feel — absent. That has been Nimmo this month, by some measures the worst of his career, as he has tried to find his swing while managing a nagging right wrist issue that he insists doesn’t affect said swing.

In the Mets’ 6-4 win over the Marlins on Friday, Nimmo looked as if he has figured it out. He went 2-for-5 with three RBIs and two runs scored, an RBI double early and the deciding blow late: a no-doubt two-run home run in the eighth off the facing of the second deck in rightfield — off a lefthander, Steven Okert, at that.

Altogether, Nimmo put in play three balls at 104 mph or faster — which is to say, very hard. That is the sort of contact that normally is routine for him but lately has been missing. He entered the day hitting .217 with a .294 OBP and .380 slugging percentage in July.

“It’s obviously a positive note to build on, but also you don’t show up to the field the next day and feel like you’ve got everything figured out,” he said. “So it’s still a work in progress, still going to be trying to get better. But it is a step in the right direction, no doubt.”

Nimmo had been 3-for-22 with no extra-base hits in five games since the All-Star break. He is healthy, he said, so that isn’t a reason for the decline in production, which has made it all the more confounding.

“When you’re injured and you’re slumping, you’re like, OK, at least I have a reason for that that makes sense,” he said. “When you’re just slumping, it doesn’t make sense to you.

“I haven’t been producing much offensively since the All-Star break, so really nice to be able to help out tonight and get a couple big hits. It obviously showed when I got the hit.”

Nimmo was “pretty ecstatic,” in his own words, about his blast, screaming his way around the bases and into the dugout. The reaction was only partially about his own struggles. After the Mets (62-37) got to Miami ace Sandy Alcantara for four runs in five innings — his shortest outing since May 6 — and erased early 3-0 and 4-3 deficits, this was a win Nimmo figured they could steal.

“When we were able to match punch for punch, I really felt like this game was one that we really needed to try and really take it at all costs,” he said. “Because when you’re able to get to a guy like that, it means a lot.”

Manager Buck Showalter said: “I don’t think he needed [the big hit]. The team needed it.”

The Mets’ other offensive standouts: Daniel Vogelbach, who had two doubles and a walk, and Starling Marte, who had three RBIs and finished a double short of a cycle.

“We were all over him about no double,” Showalter said. “He said, ‘Tomorrow.’ I said, ‘I don’t think it counts tomorrow.’  ”

Chris Bassitt allowed four runs, six hits and a season-high four walks in six innings, snapping his streak of consecutive quality starts at six — but still enough to outpitch Alcantara.

The Marlins (47-53) strung together some soft contact for three runs in the first inning, all on Miguel Rojas’ double looped down the rightfield line. Bassitt attributed his control issues to feeling too strong after extra rest between starts, a happenstantial result of the schedule.

“I’ll tell you what was characteristic of him: pitching six innings and getting better the last two innings,” Showalter said. “He didn’t let any of those innings get away from him.”

Bassitt said: “I had no control over where the ball was going. That’ll iron itself out. I’m not too concerned about that one bit.”

In four games against the Mets, all in the past month and a half, Alcantara has a 3.33 ERA. Against everybody else this year, he has a 1.69 ERA. “We caught him on a night when he wasn’t his normal self,” Showalter said, “and we’re fortunate.”