The ball tore a hole in the cold October air, headed out toward the Capitol Dome, gleaming white in the starless sky. Jayson Werth tossed his bat and pointed to the home dugout at Nationals Park. Red fireworks exploded behind home plate. Werth’s teammates charged out of their dugout and the raucous fans exulted, all of them warmed by the knowledge the baseball season still lived in Washington.

They all got another day. They have another game. In the bottom of the ninth inning Thursday night, Werth ended a 13-pitch bat with a walk-off home run to lift the Nationals to a 2-1 victory over the St. Louis Cardinals to even the National League Division Series at two games each. Werth came to Washington two years ago vowing he could win with the Nationals in this city. Thursday night, he gave them the chance to play again.

“We get to play tomorrow,” Werth said. “That’s the best part.”

The Nationals, if their nerves can take it, if their hearts have not beaten through their chests, will gather Friday evening at Nationals Park for the decisive Game 5. The Cardinals have outscored Washington by 14 runs in four games, but that will be wholly irrelevant at 8:37 p.m. The Nationals will give their top pitcher, Gio Gonzalez, the ball against Cardinals right-hander Adam Wainwright in a rematch of their encounter in Game 1 of this series.

The Nationals totaled two hits in the first eight innings Thursday, as the bright afternoon sun gave way to a crisp, clear evening. They never pushed a runner past first base, relying on Adam LaRoche’s solo homer in the second off Cardinals pitcher Kyle Lohse. The zeroes added up until Werth led off the ninth against Cardinals reliever Lance Lynn for what resulted in a classic duel between batter and pitcher.

Werth took the first two pitches, two fastballs that made the count 0-2. He took ball one, a curve that barely missed low and away. After he took another fastball for ball two, Werth figured Lynn would not try another curveball.

“It seems like the whole world just kind of goes away,” Werth said afterward. “The situation just kind of melts away. You just kind of focus on the ball.”

With the count 2-2, Werth fouled off four straight fastballs. In the dugout, Nationals third baseman Ryan Zimmerman turned to bench coach Randy Knorr and said, “This is getting interesting.” Next to them, shortstop Ian Desmond thought back to a game-tying homer Werth hit off Miami Marlins pitcher Heath Bell late in the summer after fouling off a gaggle of pitches.

“He has a knack for doing it,” hitting coach Rick Eckstein said. “When he’s right, he’ll foul some pitches off and know that he’s going to foul it off. There’s other times when he’s put balls in play and he’ll say, ‘Man, I was just tying to foul it off to get to another pitch.’ ”

On the ninth pitch, Lynn tried to fool him with a curve, and Werth looped it just over the home dugout. After another fouled fastball, Werth took a curve out of the strike zone to run the count full. Another fastball, 97 mph, came hurtling in. Werth flicked it away.

Werth felt more comfortable as he swatted the pitches out of play, like he was seeing the fastball better. He looked at the scoreboard and saw Lynn’s pitch count at 12. He asked himself, “Is that right?”

On the 13th pitch of the at-bat, Lynn made the mistake Werth had waited for. Lynn grooved a 96-mph fastball over the plate’s heart. Werth lashed it to left. They all could tell it was gone— the ballpark erupted.

“He beat me,” Lynn said. “Everyone is this stadium knew what I was throwing there. You tip your cap to him. The guy can play, and he beat me.”

Werth’s teammates thrust their hands in the air on the dugout railing. Werth, after he tossed his bat, worried for a moment he had not hit the ball high enough. All year, Werth had razzed first base coach Trent Jewett for never giving him a high-five during a home run trot.

“Trent gave me a high-five,” Werth said. “I knew then it was a special moment.”

Werth pointed to the right field corner as he rounded first. The ball banged off the back of the visitors’ bullpen. His teammates gathered at the plate. “It was a scramble to go meet him,” pitcher Jordan Zimmermann said. He slapped an ankle-high five with third base coach Bo Porter, then threw his red helmet 15 feet in the air, letting it hang there like a balloon.

Afterward, he could barely remember much of at-bat. He planned to watch the replay not to relive it, but to create a new memory.

“It’s almost like I blacked out, for sure,” Werth said. “It’s like a Will Ferrell moment.”

So much had led to the moment.

Ross Detwiler, the 26-year-old left-hander who replaced Stephen Strasburg in the Nationals’ postseason rotation, allowed one unearned run in six innings. Zimmermann, Monday’s starter, followed with the most electric inning of relief since baseball returned to Washington. Tyler Clippard struck out three in the eighth.

After Clippard’s dominant eighth, Drew Storen struck out the first two batters he faced in the ninth. He walked shortstop Pete Kozma to put the go-ahead run on first. Storen worked his fourth straight full count to pinch hitter Matt Carpenter. With two strikes, Kozma bolted from first as Storen fired a fastball, his 26th pitch of the inning.

Carpenter flared it to shallow left. Off the bat, Storen thought he had an easy out. As he turned, he realized it could drop. From his view on the mound, Storen watched Desmond sprint on to the grass and saw Kozma flash in front of him, racing from second to third.

“If this drops,” Storen thought, “he’s going to score.”

Every day of the season, Desmond fields grounders during practice, and then bullpen catcher Julian Martinez hits him sky-high pop-ups for him to chase down. Now, Desmond backpedaled and shuffled. Kozma had reached third as Desmond lunged, tumbled and snared the ball.

“I’m so glad Desi’s Desi,” Storen said.

As he hopped up and jogged to the dugout, Desmond thought, “Let’s go win the ballgame.”

Seconds later, the right man walked to the plate. After Werth’s homer, hip-hop and country music blared in the Nationals’ clubhouse. Clippard stood at his locker and said, to no one in particular, “I don’t know what to do with myself.”

Werth walked across the room and slumped into a chair. He leaned forward, elbows on his knees. “I feel like I’ve got a lot of baseball left in me,” he said. “I’m not ready to be done.”