Netherlands scored twice in the last five minutes to recover from two goals down and earn a 2-2 draw against relegated Germany in the Nations League on Monday to secure a spot in next year's finals ahead of world champions France.
Virgil van Dijk struck a superb close-range volley in stoppage time to equalise for the visitors after Quincy Promes had cut the deficit in the 85th minute with the Germans having led through early goals from Timo Werner and Leroy Sane.
Switzerland, England and hosts Portugal had already qualified for the four-team finals in June.
The Dutch, on the road to recovery under new manager Ronald Koeman after failing to qualify for the last two major tournaments, topped League A Group 1 despite finishing level on seven points with France due to a better head-to-head record.
"This is the reward for our hard work," central defender Van Dijk told reporters. "It was good to get the equaliser and qualify. After a moderate first half we wanted to come out stronger after the break. We showed character tonight."
The Germans, who suffered a shock first-round exit at the World Cup in June and lost a German record six times this year, finished in last place with just two points after what has become a familiar lack of focus this year.
However, their quick young frontline, nicknamed 'the moped gang', looked promising and lived up to their tag as 22-year-olds Werner and Sane, plus Serge Gnabry, 23, frightened the Dutch defence with their speed, especially in the first half.
They had already shown their potential in a 3-0 friendly win over Russia on Thursday as coach Joachim Loew made changes after Germany's World Cup flop and Nations League relegation.
"I am a bit disappointed by the result but overall I saw more positives than negatives," Loew told reporters.
"We played a very good first half and should have scored a third in the second half to finish the game.
"But this kind of thing seems to be the story of our entire year," he said, in reference to his side's disappointing season.
The Germans took the lead after nine minutes when Werner controlled a pass with his head and then fired a precise low shot into the corner of the net from 20 metres.
Sane finished an almost identical move in the 20th, latching onto a deep Toni Kroos pass and drilling in the second goal of the evening with a deflected shot from the edge of the box.
Gnabry almost got a third with a glancing header in the 40th and Werner outsprinted his marker only to fire wide on the hour as the Dutch struggled to contain their opponents and remained toothless up front until Promes got them back in the game.
They then earned a last-gasp equaliser through Van Dijk to book their spot in the new competition's finals in Portugal.
Czechs beat Slovaks 1-0 to ensure Nations League B survival
The Czech Republic ensured their survival in Nations League B Group 1 on Monday with a 1-0 win over Slovakia thanks to a first-half Patrik Schick goal that relegated the visitors.
Ukraine had already won promotion and finished top with nine points ahead of the Czechs on six and Slovakia with three.
The Czechs had only needed a draw on Monday to guarantee staying in the section but looked in for a tough night with Slovakia pressing early on and home keeper Tomas Vaclik just tipping Marek Hamsik's drive over the bar in the 15th minute.
The Czechs slowly got into the game and grabbed the lead in the 32nd minute when AS Roma forward Schick ran onto a chipped through ball by Jakub Jankto before lobbing a nifty left-foot shot over onrushing Slovak keeper Martin Dubravka.
As the game wore on the Czechs gained in confidence and created a number of chances as Slovakia left gaps in midfield as they pushed forward in search of the goals they needed to snatch the victory that would keep them in League B.
Borek Dockal just missed out on doubling the Czech lead in the 42nd minute when his right-foot drive following a pass from Schick was just pushed past the far post by Dubravka.
The victory also marked a resurgence under Czech manager Jaroslav Silhavy, who replaced Karel Jarolim following a 5-1 defeat by Russia in a friendly in September.
In October, a late header by Schick gave the Czechs a 2-1 win over Slovakia to earn them their first points in the Nations League in between two defeats by group winners Ukraine.