MIAMI — The Mets took a chance on Jose Reyes in hopes of recovering even a slice of the energy he had once brought here. Time had changed him, of course, robbed him of some flash and speed.

But they hoped that he would still have nights when he might be that familiar dynamo, a firestarter at the top of the order, just as he was on Friday in the Mets’ 5-3 win over the Marlins.

For the first time since rejoining the Mets, Reyes collected three hits in a game. His efforts led to three runs, including the go-ahead tally in the seventh to give the Mets the lead after losing it the previous inning.

Yoenis Cespedes, back in the lineup after he was given a day off to rest his banged-up quad, knocked in a pair of runs with a pair of sacrifice flies. Reyes drove in another with an RBI single.

In the ninth, James Loney’s two-run homer off reliever Fernando Rodney landed in the upper deck in rightfield, providing ample breathing room for closer Jeurys Familia.

Meanwhile, the Mets got enough out of Logan Verrett, the spot starter who has been forced into the rotation. He departed after 5 1/3 innings with the score tied, his primary objective completed: he kept the Mets in the game.

Reliever Hansel Robles, who has emerged as critical piece in the bullpen, logged 1 2/3 innings of scoreless relief. It came ahead of setup man Addison Reed, who worked a clean eighth.

Familia shut the door in the ninth for his 34th save of the season and 50th straight regular-season save dating back Aug. 1, 2015 — the fourth longest streak in baseball history — though he again had to work for it.

Cespedes misplayed a Christian Yelich drive to left, entering into a slide only to whiff on the ball, which went down as a leadoff double. Three batters later, pinch-hitter Martin Prado delivered a two-out RBI single, bringing Adeiny Hechavarria to the plate as the winning run. But Hechavarria grounded out, ending the scare.

The Mets (51-44) picked up a game on the Marlins (52-44). Miami had begun the day 1 1/2 games clear of the Mets for both the second wild-card spot and second place in the NL East.

The Mets also gained a game on the first-place Nationals, closing to within five.

Reyes jumpstarted the Mets, doubling to start the game against Marlins lefty Adam Conley. Two batters later, Reyes swiped third base, positioning himself to score on Cespedes’ sacrifice fly.

Reyes delivered again in the fourth, upping the Mets’ lead to 2-0, this time with an RBI single that knocked in Travis d’Arnaud.

And in the seventh, Reyes helped push the Mets ahead, singling to lead off the inning against Marlins reliever David Phelps. Curtis Granderson followed with a single to left, moving Reyes to third, where he would score on another Cespedes sacrifice fly.

Indeed, the Mets had reclaimed the lead, despite the sting of losing a 2-0 advantage.

Verrett, the Mets’ fifth starter by virtue of injuries to the starting rotation, had shown signs of turning his fortunes. He retired eight straight Marlins at one point.

And in the fourth, when Miguel Rojas’ leasdoff double ended that stretch and opened the door to trouble, Verrett kept his cool.

Rojas got caught in a rundown and later, Marcell Ozuna hit into a double play that ended the inning.

But the sixth inning spelled the end. J.T. Realmuto’s led off with a double. And after Rojas grounded out to first, Verrett faced Yelich. Verrett settled on a breaking pitch, only to leave it hanging over the heart of the plate. Yelich hammered it, slamming a game-tying two-run shot over the fence in centerfield.

From the dugout, manager Terry Collins emerged with the hook, with no interest in tempting fate. He’d gotten enough out of Verrett, who allowed two runs in 5 1/3 innings, lowering his ERA as a starter from 5.20 to 4.97.