Max Scherzer brought his phone to the center of the Washington Nationals’ clubhouse, just a few feet from a big TV screen, and — for all his teammates to see, with his face stone sober — Mad Max took a long video of himself making a fool of himself.

“And he’s coming home. There’s the winning run,” Scherzer said calmly, almost to himself, as the image of the Nats’ Adam Eaton sliding headfirst across home plate flashed across screens all over the clubhouse. “We win . . .”

Scherzer paused.

“And,” he said mockingly, his voice dropping into a mortified drone, “it’s the eighth inning.”

If you want a scene, a symbol of a team in full laughing, joyous flight at the all-star break, that moment arrived Sunday at Nationals Park. The great Scherzer, the likely future Hall of Famer, ran onto the field — alone, all alone — to celebrate a walk-off win . . . an inning too soon.

The 5-2 victory over Kansas City is now just a nice footnote. For half an hour after the game, the Nats played the same 30-second tape on every TV screen in the clubhouse, with “Max Walk Off” under it.

“I’ve seen it 15 times. It gets better every time,” said closer Sean Doolittle, who blew the save in the eighth inning but ended up getting a four-out win.

With the score tied at 2 in the eighth, Anthony Rendon doubled into the left-center field gap, barely scoring Eaton thanks to a gutty one-out send by third base coach Bob Henley. Scherzer thought the game was over, so he ran toward home plate, slapped Eaton on the butt and turned around to join the mass celebration. But there wasn’t one — just Juan Soto, the next hitter, going up to bat. Still an inning to go, Max.

Trying to act normal, he quickly walked back to the dugout, hoping — in what surely would be a baseball miracle — not to be caught. But Brian Dozier was already laughing so hard that he looked like he would cry. Then Adrián Sanchez began beating on a water cooler because laughing just wasn’t enough.

In a blink, Scherzer began accepting congratulations — getting high-fives from a tunnel of teammates — as if he had hit a home run. Then, blank-faced, he walked back through the dugout holding up one finger — as if to say, “One more inning to play.”

“Guess you’re going to want to show that to everybody at the All-Star Game,” I said to Scherzer, nodding at his phone.

“You can’t make that one up,” he said, as close to sheepish as he is ever likely to get. “Doolittle pitches the ninth, right?”

Sorry, that excuse won’t fly, Max. And nobody cares. Suddenly, a season that seemed lost has been turned on its head and, for the Nats, everything seems possible. Even mistakes are funny.

On May 23, the Nats, at 19-31, had the 14th-best — or second-to-worst — record in the National League. Now, helped by Patrick Corbin’s seven scoreless innings Sunday, they are 47-42 and have the third-best record in the NL — behind only the Los Angeles Dodgers and Atlanta Braves — and a slim hold on the first wild-card spot.

As if to remind everyone how precarious their 28-11 surge has been, the Nats once again blew a lead in the eighth inning Sunday as 42-year-old Fernando Rodney gave up a single, a stolen base and an RBI single. Doolittle then allowed a first-pitch RBI double to Alex Gordon on a tame, 92-mph, knee-high fastball.

“Only 92 — that’s kind of all I had in the tank today,” Doolittle said. “Then we came right back and scored three runs — put together the best at-bats of the day. . . . Oh, my gosh, that was awesome. . . . I can’t tell you how much I appreciate being part of this team.”

Doolittle has some “oh, my gosh” in him, but the feeling is sincere and, for now, runs through the clubhouse. If the Nationals don’t find at least one more quality bullpen arm by the July 31 trade deadline, all the camaraderie in the world may not keep them rolling. But whatever good vibes can bring, they’ve got it.

“We got punched in the mouth early. If it’s not this veteran group of guys, I don’t know if it would have turned. This game will get you down and eat you alive,” said Dozier, whose 14th home run opened the scoring before Victor Robles’s 13th made it 2-0. “But we did it. It’s still going to be a test the rest of the way. I like our chances.”

The Nats anticipated improved team chemistry, by addition and subtraction. But they may have underestimated how veteran-packed teams can find an extra edge — such as pairing Kurt Suzuki with Scherzer after his early results with Yan Gomes were disappointing (a 3.67 ERA in eight games). In 12 starts with Suzuki, Scherzer’s ERA is 1.46 — his best mark with any catcher who has ever caught him (for more than two games) by more than a full run. Scherzer’s 115-14 strikeout-to-walk ratio in 80⅓ innings with Suzuki is incredible.

“Max is just so smart — such a student of the game,” Suzuki said.

That’s just another reason the Nats enjoyed Max’s solitary celebration so much. He challenges everybody at everything at all times. Sometimes, he seems almost superhuman. On Saturday, he insisted on pitching on his normal day even though his wife, Erica, had given birth to their second daughter, Kacey, on the morning of the Fourth of July and he, presumably, had gotten little sleep. He looked exhausted and will not pitch in Tuesday’s All-Star Game because he says his back has been feeling tight. But he nonetheless went seven scoreless innings — and even stole a base.

Scherzer loves to get ragged, maybe even more than he loves dishing it out. But he provides so few opportunities that they’re almost cherished. “That’s just Max,” Dozier said of Scherzer’s 6-year-old enthusiasm.

Scherzer, if he can remember what inning it is, is also a main reason the Nats would be a dangerous foe — over a short series — in October.

“Yeah, but we’ve got to get to October,” Dozier said.

In the past 6½ weeks, they have made huge strides — and gotten some help.

“We knew we were capable,” Doolittle said. “But some other teams had to cooperate. I’d look at the standings, and every time it was like, ‘We just made up two or three games!’ It can be really grueling when you are playing really well but you can’t make up ground because so are the teams ahead of you.”

While the Nats have streaked, many teams, such as the Philadelphia Phillies, Chicago Cubs and Milwaukee Brewers, have floundered. But the Dodgers and Braves (who lead the Nats by six games and whom they play 14 more times) certainly have not. Are the Nats good enough, and have they knitted together enough, to handle them?

The stage is set for the Nats to show they’re the team they thought they were when spring training opened. It won’t be a laugh, like Sunday was, but it sure looks like fun.

More on the Nationals and MLB: