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 due to a better head-to-head record despite finishing level on seven points with France.
"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 Low 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," Low 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.