NEW YORK — With August coming to a close, Miami Marlins manager Don Mattingly remains optimistic that, despite a 10-18 record to fall 3 1/2 games behind St. Louis for the second National League Wild Card, good times could still be right around the corner.

“In three or four days, five days from now, it could be a whole different story and things can change really quickly,” he said. “Games get tough to win down the stretch. They’re tough for us but they’re also tough for other teams too.”

Kelly Johnson’s three-run double in the eighth inning broke a tie and lifted the surging New York Mets to a 5-2 win over the Marlins on Wednesday night, spoiling Jake Esch’s major league debut. The loss was Miami’s fifth straight.

“We’ve got to take care of ourselves and can’t be concerned with getting help at this point,” Mattingly said. “We’ve just got to win games.”

Esch was pressed into duty after scheduled starter David Phelps was placed on the 15-day disabled list before the game with a strained oblique. Phelps suffered the injury on his first swing during pitcher’s batting practice on Tuesday but thought he might be able to pitch through the injury.

Arriving at 2 o’clock, Esch was remarkably poised in his first big league inning, recording a pair of strikeouts.

Esch pitched into and out of trouble in the second, allowing four consecutive baserunners to reach, including Wilmer Flores’ two-run home run. He induced a double play ball from Mets’ starter Bartolo Colon to end the threat.

Thanks to a pair of sparkling defensive plays from Marcell Ozuna and Ichiro Suzuki, those would be the only runs Esch would allow in his 4 1-3 innings.

With New York leading 2-1 and runners on first and second, Ozuna made a diving catch on Flores’ sinking line drive to end the third inning. After initially stepping to his left, he quickly changed direction, ranged to his right and made a nifty grab before tumbling over. He appeared to land on his left wrist before rolling over several times.

Ozuna left the game at the start of the fourth. Jeff Francouer entered the game in right and Suzuki slid over to center. X-rays on Ozuna were negative and he is day-to-day.

Miami again caught a break when Suzuki leaped above the center field wall to take a potential two-run homer away from Curtis Granderson in the fifth.

Christian Yelich homered off Colon to tie the game in the sixth, the third time he’s homered in back-to-back games this season.

Yoenis Cespedes singled off A.J. Ramos (1-2) to start the winning rally. Curtis Granderson walked. Flores flew out to center, advancing a hustling Cespedes to third. After Jay Bruce flew out to right, Travis d’Arnaud walked to load the bases, bringing up Johnson.

Johnson, who was 25-for-79 with the bases loaded in his career with 74 RBIs, drove the ball into the right field corner. He emphatically clapped his hands and swung his arms into the air after reaching second base.

“I can’t explain the importance of having a veteran player who has been through many, many different situations, who can come off the bench and be a big hitter in big situations,” Mets manager Terry Collins said.

Addison Reed (4-2) pitched a perfect eighth inning for the win. Jeurys Familia closed for his 44th save.

Ramos also blew the save in Monday’s series-opener and the All-Star reliever has not quite looked like the same pitcher since suffering a fractured middle finger on his pitching hand earlier this month.

“I threw a slider that I was trying to make it around the zone and he took advantage of it,” he said. “He did what he’s supposed to do with that in a big situation.”

“Obviously we know he’s not a hundred percent,” Mattingly said.

TRAINER’S ROOM:

Mets: After the game, Collins said that 2B Neil Walker would probably opt for surgery to repair a herniated disc in his back.

Marlins: RHP Andrew Cashner threw a bullpen session and Mattingly said he felt good about him starting on Friday. Cashner was scratched from his last scheduled start because of a blister.

UP NEXT:

RHP Jacob deGrom (7-7, 2.96 ERA) pitches the series finale against RHP Jose Urena (2-5, 5.83 ERA) opposes deGrom. Urena’s lost four of six starts since moving to the Marlins’ rotation on July 19.

VET STATUS:

Suzuki (42 years, 314 days) and Colon (43 years, 99 days) matched up for three at-bats on Wednesday. According to Elias Sports Bureau, the combined age of 86 years, 48 days is the oldest batter-pitcher matchup since Jamie Moyer faced Henry Blanco and John McDonald on May 16, 2012.