Sewald allowed four hits to his five batters, including Trea Turner’s run-scoring double and Anthony Rendon’s R.B.I. single. Avilan allowed a single to load the bases, and then Diaz (1-7) relieved and allowed a two-run double to pinch-hitter Ryan Zimmerman, followed by Suzuki’s blast.

Suzuki pointed into the home dugout before rounding first base, pumped his fist at second and was swarmed by teammates at home plate. It was his 16th home run of the season.

Javy Guerra (3-1) retired the only batter he faced to end the Mets’ ninth.

Washington is the first team to allow five or more runs in the top of the ninth and get even more in the bottom of the inning for a walk-off victory since the Boston Red Sox did so on June 18, 1962, against the Washington Senators, according to STATS. The Nationals/Expos franchise had never won a game after trailing by at least six runs in the ninth or later.

The Mets’ five-run ninth was aided by Turner, the Nationals’ shortstop, who apparently forgot how many outs there were and passed on a possible double-play grounder, instead throwing to first.

The game began as a duel between the most recent N.L. Cy Young Award winners. Washington’s Max Scherzer allowed four runs and five hits while striking out seven in six innings, the longest of his three starts since coming off the injured list last month.