St. Louis is two games ahead of Los Angeles in the battle for the second Wild Card spot in the National League. Both teams have four games remaining.
The Cardinals' magic number sits at three. They have won nine of their last 12 and had a five-game home winning streak snapped.
St. Louis falls to 6-12 in extra innings. The 12 losses are the most in the NL.
Kozma sparked a rally from an early 4-0 deficit with a two-run double in the seventh.
"I'm having a blast, we're in a playoff race," Kozma said. "It was a tough one to swallow today. But I'm having fun."
Kozma has driven in a run in six of his last seven games. He is hitting .306 with 11 RBIs in 22 contests.
Kozma struggled during most of the season with the Cardinals' Triple-A Memphis squad. He finished at .232 in 131 games with the Redbirds. But he has clearly flourished since being called up Aug. 31. He can't explain his sudden resurgence.
"I have no idea," he said. "The ball is falling -- so I'm not complaining."
Kozma, at shortstop, also made a nifty defensive play Saturday ranging deep into the hole to throw out pinch-hitter Chad Tracy in the ninth.
But Kozma's heroics went to waste thanks to Kurt Suzuki, who crushed a two-run double off Fernando Salas with two outs in the 10th to break the tie. Reliever Sam Freeman walked Adam LaRoche to begin the 10th.
The Cardinals scored three times in the seventh and completed the comeback with a run off Washington closer Drew Storen in the ninth. Kozma and pinch-hitter Daniel Descalso slapped one-out hits, and Jon Jay delivered a sacrifice fly to center to tie it at 4.
"We put up a good fight, we matched them at four [runs]," said first baseman Allen Craig. "We just couldn't close it out in extra innings. It was a tough game. We battled hard. We've just got to get them tomorrow."
Cardinals starter Kyle Lohse, the leading candidate to start a potential NL Wild Card game at Atlanta on Friday, gave up a grand slam to Michael Morse in the first inning. Lohse, who has surrendered nine grand slams in his career, then returned to his usual razor-sharp form, striking out a season-high nine. He shut out the Nationals on five hits over his final five innings after the first-inning blunder.
"I put us in a pretty good hole, but the guys did a good job battling back," Lohse said. "The only thing you can do after that is keep them right there [at four runs], and that's what I was able to do."
St. Louis manager Mike Matheny was pleased with the way Lohse bounced back after giving up the slam on his 23rd pitch of the game.
"He did a good job of putting it behind him," Matheny said. "His stuff looked right."
The Cardinals scored three times off Nationals starter Jordan Zimmermann to climb to within 4-3 in the seventh. Carlos Beltran started the rally with a single that broke his 0-for-13 slump. Skip Schumaker added a double and Kozma followed with a two-run double down the left-field line that cut the deficit to 4-2. Pinch-hitter David Freese, making his first appearance since suffering a right ankle injury on Monday, drew a walk. Jay chipped in with a run-scoring single to right. But Matt Carpenter and Matt Holliday flied out to end the uprising.
Zimmermann allowed three runs on seven hits over 6 1/3 innings.
Lohse struck out Jayson Werth to start the game, but Bryce Harper followed with a single and Ryan Zimmerman added a double. LaRoche walked to set the stage for Morse's 17th homer of the season.
"I think it was a two-seamer, a cutter away," Morse said.
The 376-drive barely cleared the wall in right-center field. It was originally ruled a single, but the umpiring crew, led by chief Jeff Nelson, went to the instant replay and overturned the call, awarding Morse a grand slam.
"If you can take two pitches out of the 100 I threw and change them, that would be great," Lohse said. "This game is a matter of inches. That ball barely gets out. You've just got to be able to move on."
Holliday led off the 10th with a single, but Craig grounded into a double play. Reliever Craig Stammen then struck out Yadier Molina to end the game.
"We came back from a four-run deficit, that's a pretty good spark," Matheny said. "The team didn't roll over."