MIAMI — Matt Harvey had just been upstaged Sunday. As good as he was against the Marlins, nobody was going to touch Jose Fernandez, especially a depleted Mets lineup held together by little more than duct tape and prayers.

Nevertheless, as Harvey slipped on a tailored suit jacket and dissected his outing after a 1-0 loss, he couldn’t help but hide the makings of a smile.

Yes, a long way remains until he can fully scrub away the nightmarish start to his season. But for the second straight outing, he provided the Mets reason for cautious optimism.

“It’s still two starts,” Harvey said after allowing one run in seven innings, his second straight quality start. “Obviously, the massive struggles that happened before, the only thing you want to think of is not letting that creep back in. Today was, I guess you could say, a second step from last start.”

But with the hobbled Mets forced to contend with Fernandez, a true ace at the height of his powers, the afternoon unfolded with a sense of inevitability. He went seven innings, allowed four hits and no walks, and tied a career high with 14 strikeouts.

Fernandez (9-2, 2.29 ERA) retired 15 straight at one point, breaking a sweat only in the seventh inning, when the Mets strung together consecutive two-out hits. But he squashed any hope, striking out Wilmer Flores with a nasty breaking pitch.

Fernandez stormed off the mound, pounding his chest and his hip, a sense of invisibility radiating with every step.

“We saw two aces today,” Mets catcher Rene Rivera said. “That’s what they’re supposed to do.”

Not that the Mets were equipped to put up a fight, with the list of walking wounded piling up so quickly that manager Terry Collins resorted to gallows humor to cope.

He joked about using his base coaches as bench players and said — in all seriousness — that the team’s starting pitchers may be summoned as pinch hitters.

In recent days, Collins has reduced his job to simply making sure he has nine names to write in the lineup. He barely made the cut against the Marlins.

Yoenis Cespedes still was battling a sore hip, though he was available to fly out as a pinch hitter.

Juan Lagares was diagnosed with a sprained left thumb, though he was not placed on the disabled list. Instead, he will visit Mets doctors Monday in New York, potentially leaving Collins shorthanded again.

Sunday brought forth more reminders that help may be a ways off.

Catcher Travis d’Arnaud began a rehab assignment with Class A St. Lucie, serving as the designated hitter. There is no timetable for when his right rotator cuff will be healthy enough for him to begin throwing to the bases, which in turn leaves his return date open-ended.

First baseman Lucas Duda joined the team from the Mets’ complex in Port St. Lucie, but the stress fracture in his back has limited his activity to riding an exercise bike. His return still is being measured in weeks, not days.

Until then, the Mets can only hope that their vaunted starting rotation can carry the burden, a reason that Harvey’s upswing is well-timed.

Against the Marlins, his only mistake was a pitch left up to Derek Dietrich, who ripped a fifth-inning double. J.T. Realmuto singled up the middle, ending Harvey’s scoreless-innings streak at 11, including the seven shutout frames he tossed against the White Sox last Monday.

Harvey’s fastball velocity roared up to 97 mph, gaining steam as the game went along. But he struck out only three, a sign that work remains. And after the game, he admitted that at times he still “leaks” to the plate, a mechanical flaw in which his arm drags behind and his command suffers.

But with two starts of sanity after a season of horrors, noting those flaws sounded like nitpicking. Though he fell to 4-8, he lowered his ERA to 4.95.

Said Harvey: “Overall as a whole, when you go seven and limit damage and give your team a chance to win, it’s pretty satisfying.”