On Sunday night, Matt Williams devoured dinner at an Italian restaurant, retreated to his hotel room, lay in bed and found sleep futile. “Nervous energy,” he said. “That’s part of the deal.” He had never managed a major league game before, and all possibilities rattled around his head. Whatever stresses he conjured could not have matched reality, could not have competed with the catch-your-breath, flip-your-stomach moments the Washington Nationals presented him with the first day on the job.

On a chilly, sun-drenched afternoon at Citi Field, the Nationals won Williams’s debut, 9-7, against the New York Mets. The Nationals did not hold the lead until the 10th inning, when Ian Desmond lifted Jeurys Familia’s two-strike slider to center field for a sacrifice fly. Two batters later, Anthony Rendon celebrated his first opening day with a three-run homer off former National John Lannan. To reach that point, Williams and the Nationals endured maddening twists, blissful highs and sickening blows.

“I’m alive, yeah,” Williams said. “Right in the thick of it.”

The celebration in the Nationals’ clubhouse was muted by the worst moment: Catcher Wilson Ramos, whom Williams tabbed as his cleanup hitter, believed he broke his left hand on a foul tip, according to a person familiar with the situation, and left before the seventh inning. Williams said initial X-rays came back negative.

The day’s other events paled in magnitude, but the game gave Williams plenty of them. In the second inning, Williams rushed to the middle of the diamond, where Bryce Harper lay supine on the infield dirt — his head had collided with the shin of the Mets’ Eric Young Jr. as he slid into second base. Harper stayed in the game, and he stood in left field in the bottom half of the inning as Williams’s ace, Stephen Strasburg, gave up his fourth run in the year’s first two innings.

Williams pulled strings as the Nationals scored twice in the seventh, only to watch the rally wither with the bases loaded. He remained stoic as Tyler Clippard, a reliable eighth-inning horse for four years, surrendered a tiebreaking home run to Juan Lagares on an 0-2 fastball.

He watched Danny Espinosa work an eight-pitch, pinch-hit, two-out walk in the ninth, which allowed Denard Span the opportunity to smack a game-tying double. He asked Aaron Barrett to make his big league debut in the bottom of the ninth in a tie game and watched as Barrett blew away three Mets. He kept Espinosa in the game on a double-switch that removed Ryan Zimmerman. Even after Rendon’s homer, Nationals reliever Jerry Blevins provided one last slice of drama when he allowed a two-run homer to David Wright in the 10th.

Welcome to the dugout, Matt. Now come the next 161.

“I thought he was pretty calm the whole time,” Espinosa said. “It didn’t seem like anything fazed him. I don’t know if he was calm on the inside. But he definitely portrayed a very calm manager.”

In their opener, the Nationals already have deviated from their disappointing 2013 season. Last year, they did not win after facing a three-run deficit until June 28, and they came back to win after they trailed in the sixth or later for the first time June 5. They accomplished both on this opening day.

“We learned from experience from last year,” Span said. “We were buckling down in spring training, taking every at-bat serious. Everybody just came with a different attitude.”

“It was a well-played team game — emphasis on team,” Desmond said. “Maybe that’s what was missing from last year. It was evident today.”

Strasburg allowed four runs in six innings, a mediocre start that could easily be viewed through an optimistic prism. The command of his fastball escaped him in the early innings. He threw one terrible pitch at the worst moment, a 2-2 fastball with two outs and two on in the first inning, and Andrew Brown crushed a three-run homer that bruised the seats.

When his outing could have unraveled, he stayed cool in the saddle. The Mets jumped on early fastballs, and so Strasburg relied heavily on his off-speed pitches, including the slider he unveiled this spring. With one of those, he struck out Wright.

“They came out swinging and didn’t really let me settle in,” Strasburg said. “I said, ‘The heck with it. I’m just going to go out there and throw everything I got.’ ”

Strasburg retired the last 10 hitters he faced, struck out 10 overall against two walks and threw only 41 pitches in his final three innings. His fastball reached 95 mph in the first, but in his latter innings it hummed between 91 and 93, less velocity than usual. He did not seem concerned, and after all, the Mets couldn’t hit it, anyway.

“It felt pretty good,” Strasburg said. “I guess radar guns have [an] offseason, too.”

Strasburg allowed his team an opportunity, but the offense faced the wrong pitcher to come back against, a right-hander largely anonymous across the sport and cursed in Washington’s clubhouse. Before Monday afternoon, Dillon Gee had gone 7-3 with a 3.04 ERA against the Nationals.

Gee carved through them again. After Adam LaRoche’s titanic, two-run home run in the second inning, Gee retired 15 consecutive hitters, a streak broken in the seventh inning when Harper’s one-out single nearly knocked over Young Jr.

The hit began the Nationals’ first rally of the season. Desmond reached on a fielder’s choice that sent Harper, almost cruelly, sliding into second base again. LaRoche drew a two-out walk, which brought Rendon to the plate. Rendon slapped a double into the right field corner, which scored Desmond for the first of Rendon’s four RBI and sent LaRoche to third.

The double gave way to managerial tactics and slapstick relief pitching. Williams sent Kevin Frandsen to the plate as a pinch hitter, which prompted Mets Manager Terry Collins to summon right-hander Carlos Torres. Williams countered, pulling back Frandsen and sending up Nate McLouth.

Torres walked McLouth on four consecutive balls. Collins beat the path back to the mound and called for rubber-armed lefty Scott Rice to face Span with the bases loaded. Rice threw four straight balls, the last one not close to the plate, to force home the tying run.

Jose Valverde entered and struck out Zimmerman with a 91-mph fastball to end the threat. Williams faced a predicament. With Ramos out and Frandsen burned, the Nationals had lost their starting catcher and their first emergency catcher. Espinosa was the only other candidate to catch, and so he double-switched Zimmerman out of the game to keep Espinosa available.

“He made a huge, really tough decision to take the face of the franchise out,” Desmond said. “That was a pretty gutsy decision. He kept his composure the whole game.”

Lagares’s home run only set up a redemptive at-bat from Espinosa, whom the Nationals exiled to Class AAA Syracuse in the middle of last season. With two outs, Espinosa watched pitches just off the corner and fouled away Bobby Parnell’s tough, inside pitches. He took ball four and kept the game alive.

“I feel like that was the at-bat that won the game for us,” Span said.

First, though, Span had to drive in the tying run. He smoked a line drive to left-center, scoring Desmond and pushing the game to the bottom of the ninth. Barrett came to the mound, and Desmond met him there. “Soak it all in,” he told Barrett.

Williams, too, could soak in a new experience. The Nationals will take Tuesday off and regroup without their bedrock catcher Wednesday. An entire season still awaits, but for one evening, Williams had earned the right to relax.

“I’ll probably sleep really good tonight,” he said.