WASHINGTON — The hangover from their worst loss of the season — or maybe the decade — was allowed to linger for roughly 12 hours.

By the time the Mets arrived at Nationals Park on Wednesday, Mickey Callaway was ready to meet with his team and purge the frustration of the previous night. Again, the Mets built a six-run lead on the Nationals. This time, however, most of it stuck, in an 8-4 victory that gave the Mets a second straight series win.

The rebound did nothing to fix the standings, and the fact they are still 4½ games behind the Cubs for the NL’s second wild card. At least the Mets have the slightest pulse as they return to Citi Field on Friday night to face the Phillies for the start of a nine-game homestand.

A night earlier, relievers Paul Sewald, Luis Avilan and Edwin Diaz had combined to flush a six-run lead in the ninth inning in an 11-10 loss. In their history, the Mets had been 806-0 with a six-run lead in the ninth inning or later.

“I am proud of the guys,” Callaway said. “That was a tough loss [Tuesday] night, but we bounced back well.”

It got jittery again Wednesday with the Mets bullpen, as Jeurys Familia surrendered three earned runs in the sixth, slicing the Mets’ lead to 7-4. But Avilan got the Mets through the inning before Seth Lugo pitched a scoreless seventh and eighth. Justin Wilson nailed down the ninth.

“We all knew how tough [Tuesday] night was, but with the group we have in here, we knew that wasn’t going to get to us,” Lugo said. “Come out with a fresh game and keep playing the way we have been playing and do our best to execute pitches and try to win a game.”

Zack Wheeler slogged though five innings, throwing 101 pitches and allowing one earned run on seven hits and two walks with three strikeouts. The right-hander encountered early heavy traffic, but rebounded to retire six of the final seven batters he faced.

Wheeler, as the next day’s starting pitcher, had departed before Tuesday’s game concluded to get his sleep at the team hotel and said he was unaware of what had transpired until Wednesday morning. He said he learned on Twitter about the Mets’ ninth-inning collapse.

“That wasn’t in my head,” Wheeler said, referring to Tuesday’s meltdown. “But the feeling around here was, ‘Tough game last night, tough loss, but let’s go out here today and win that series.’ ”

Callaway said he had been prepared to let Wheeler pitch the sixth, but the pitcher’s spot in the batting order arose, changing the plan. Wheeler needed 76 pitches to survive the first three innings alone.

“Things weren’t going great, but he gutted through it, and that kind of defines a pitcher,” Callaway said. “Days like this, and how are you going to get through the game? And he did a great job.”

The Mets established a cushion on Amed Rosario’s RBI single in the sixth inning against Anibal Sanchez that extended their lead to 6-1. After Robinson Cano had walked leading off the inning and J.D. Davis’ roller hit third base and became a single, Rosario served a shot to center that Victor Robles booted, allowing Davis to score behind Cano. Jeff McNeil’s RBI single later in the inning extended the lead.

Pete Alonso blasted his second homer in as many games and third on the road trip to give the Mets a 4-1 lead in the fourth. The homer was Alonso’s 45th, giving him the major league lead and moving him within seven of tying Aaron Judge’s MLB rookie record.

Cano’s two-run homer in the fourth gave the Mets a 3-1 lead. The homer was Cano’s 11th of the season. Juan Lagares’ first homer since May 5, spanning 158 at-bats, had tied it 1-1 in the third.

Wheeler surrendered an RBI single to Trea Turner in the second and then walked Asdrubal Cabrera to load the bases before working the count full to Anthony Rendon, who flew out to left to keep the Mets’ deficit at 1-0.

“We still feel good about our chances,” Wheeler said. “We’ve got to battle, we have got to win more games, and we have to go out there and play well fundamentally.”

Purchase event tickets to The Amazin’ 1969 New York Mets: A World Championship for the Ages presented by The Paley Center for Media and New York Post. Enter promo code: NYPOST to unlock tickets only available for Post readers.