Mets outfielder Starling Marte, second from left, shortstop Francisco Lindor,...

Mets outfielder Starling Marte, second from left, shortstop Francisco Lindor, second from right, pitcher Edwin Díaz and catcher Francisco Alvarez, left, laugh as they walk off the field after defeating the Reds on Friday in Cincinnati. Credit: AP/Michael Swensen

CINCINNATI — The margin of error for the Mets was the length of a single spike on a left shoe. It was the few inches to Luisangel Acuna’s left. It was the whisper of space between a ball that went down the line just foul.

“I know I’ve got two choices,” Edwin Diaz said, “win the game or lose the game, so I made the right choice — win the game.”

After a broken front cleat led Diaz to load the bases with none out in the ninth, the closer was able to change his shoes, change the narrative and preserve the Mets’ 5-4 win over the Reds at Great American Ball Park — with an assist from a game-ending defensive stop by Acuna.

The Reds, one of the few teams still challenging the Mets for the third and final wild-card spot, fell six games behind. The Mets (76-65) moved into a tie with the Padres for the second wild card and lead the Giants by four games.

Holding on to a one-run lead in the ninth, Diaz allowed a single by Ke’Bryan Hayes and walked Matt McLain and TJ Friedl.

Diaz struck out Noelvi Marte and then, with a 1-and-2 count on Elly De La Cruz, he noticed something was amiss: He’d been slipping off the mound since he came into the game, and a quick inspection showed that the front spike on his shoe had broken off.

The shoes were swapped right there (he has only two pairs left with him, he noted after the game, and they’re the wrong color), and De La Cruz struck out looking.

That brought up Gavin Lux, who nearly won the game with a shot down the line that was just foul. Then Lux hit another hard grounder that went past a diving Pete Alonso and seemed destined for the outfield. Acuna, though, made a tumbling grab to his left and tossed it to Diaz to preserve the win.

“[Diaz] was incredible,” said Ryne Stanek, who stranded the bases loaded in the sixth. “I was sitting in [the clubhouse] talking to [Tyler] Rogers when it happened and I go, well, if anyone can get out of this, it should be Sugar ... Definitely didn’t make it easy, but that was one hell of a Houdini.”

The Mets scored three runs in the first off Andrew Abbott and took a 5-1 lead in the fourth on Juan Soto’s RBI double. Mark Vientos went 2-for-4 with two RBIs and a homer and Francisco Lindor scored twice.

The Reds scored three runs off David Peterson in the bottom of the fourth on Tyler Stephenson’s two-run double and Hayes’ sacrifice fly. Peterson allowed four runs and seven hits with a walk and four strikeouts and departed with one out in the sixth, replaced by Stanek, who walked a batter but struck out two.

The margin was slim, but it looked to be enough until the ninth, when everything went wrong for Diaz before everything went right.

Even the final play was a sort of vindication: Diaz nearly lost the Mets their wild card-clinching game against Atlanta last year when he failed to cover first base. This time, when Acuna made his diving stop, he was at the bag.

“I always remember that,” Diaz said. “Every time they hit the ball to the first-base side, the second-base side, I’ve got to go quick ... I don’t want that to happen again like it happened in Atlanta last year.”

In short, there’s no margin for error — not even a spike’s worth.

SUBSCRIBE

Unlimited Digital AccessOnly 25¢for 6 months

ACT NOWSALE ENDS SOON | CANCEL ANYTIME