The Nationals have an 8½- game lead in the National League East and a lineup capable of making opposing managers break out in a cold sweat. Before Sunday night, they’d beaten the Mets in seven of their last nine meetings.

In almost every way, they have the advantage. Almost.

With their rotation in tatters and so much of their Opening Day roster injured, the Mets have demonstrated a stubborn, almost defiant, level of resilience. Their latest display, a 5-1 win over the Nationals in the rubber game of the series, was a testament to that.

Take away Matt Harvey, they seemed to say in this last stretch, take away Steven Matz and Jacob deGrom. We’ll do it with Robert Gsellman and Seth Lugo instead.

“I’m real proud of these guys,” Terry Collins said. “We’re going to September in a pennant race, and that’s a lot of fun . . . These young guys have really been exceptional.”

The Mets have won 11 of their last 15. They remained one game behind the Cardinals, who are in the second wild-card spot, and inched up on the slumping Giants, who hold the first spot.

advertisement | advertise on newsday

They also got huge contributions from a couple of bats that more or less had been asleep for the better part of the last month. Curtis Granderson and Jay Bruce homered and provided all of the Mets’ offense. Which is pretty good news for the Mets, given that they’re without Neil Walker, David Wright, Lucas Duda . . . and, well, you get the idea.

On Sunday night, Lugo impressed with ability that rivaled any established member of the rotation. He far outdueled rookie Reynaldo Lopez and held the Nationals to one run in seven innings. In what probably was the highlight of his baseball life, he allowed six hits, routinely challenged the heart of the lineup with his fastball and sinker, and left the game to a standing ovation after throwing 101 pitches.

“That was pretty awesome,” he said. “The adrenaline was going and it was a lot of fun . . . I just had good command of my fastball tonight. I put it where I want it . . . I tell myself they’re just hitters up there, not the name on the back of the jersey.”

He retired 11 straight at one point. After posting a 6.50 ERA with Triple-A Las Vegas this year, Lugo is down to 2.38 in four games with the Mets. Stubborn resilience? This would be it.

Granderson’s sacrifice fly gave the Mets a 1-0 lead and his two-run blast — his 23rd homer of the season — made it 3-1. He has eight RBIs in his last six games.

Mets videos

Bruce, who entered the game hitting a woeful .198 as a Met, is showing clear signs of the hitter he was for the Reds in the first half of the season. He hit a hard single to right in the second — he ended the inning by unsuccessfully trying to go first to third on a single — and then hit a two-run homer to left-center in the sixth.

It was his 29th homer of the season but only his fourth as a Met. He’s hit safely in five straight games.

“Getting pitches that I can do something with and doing something with them is the big difference,” Bruce said. “ . . . It’s mainly the results that have changed. My feelings at the plate haven’t changed a whole lot.”

Bruce’s home run made a little Mets history: It was their 97th homer hit at home, breaking the record of 96 set at Shea Stadium in 2006.

The Mets play in Cincinnati on Monday. “I told him I think we must be getting close to Cincinnati,” Collins said of the former Red. “He’s got that swing back . . . Hopefully, this guy gets as hot as we know we can be. He’s going to have to carry us.”