Hungary and Slovakia also won to secure spots at the tournament which was postponed earlier this year because of the coronavirus pandemic and is now set for June and July of 2021.
An extra year’s wait will not matter to Scotland, who had gone through 10 failed qualifying campaigns since their last major tournament, the 1998 World Cup, and nearly threw away their play-off final against Serbia.
Steve Clarke’s team led courtesy of Ryan Christie’s strike early in the second half in the rain in Belgrade, but Luka Jovic headed in to make it 1-1 in the 90th minute, forcing extra time.
There were no more goals, and Scotland triumphed 5-4 on penalties as goalkeeper David Marshall saved Aleksandar Mitrovic’s last spot kick, sparking joyous scenes of celebration in an empty stadium.
Unbeaten in nine games, Scotland can look forward to a trip to Wembley to play England, and will also face the Czech Republic and Croatia in Glasgow in Group D at the finals.
“The way the game went tonight, conceding that late equaliser and still digging in. Then big ‘Marsh’ comes up, amazing, unbelievable,” said Celtic star Christie.
Struggling to hold back tears, he added: “I’m gone. It’s for the whole nation, it’s been a horrible year for everyone. We knew coming into the game we could give a little something to the country and I hope everyone back home is having a party tonight.
“We’ve been through so many years and it’s the monkey off the back now.”
Northern Ireland denied
There was no such joy for Northern Ireland, who went to Euro 2016 but will miss out on the next European Championship after losing 2-1 in extra time to Slovakia in Belfast.
Milan Skriniar’s late own goal gave Ian Baraclough’s side a lifeline after Juraj Kucka put Slovakia ahead, but Michal Duris won it for Slovakia in the 110th minute.
Slovakia, who beat the Republic of Ireland on penalties in the semi-finals, will go into Group E at the finals with Poland, Spain and Sweden.
Hungary came from behind to stun Iceland and secure their place, two late goals in Budapest giving them a 2-1 victory.
Iceland looked set to reach a third straight major tournament after Gylfi Sigurdsson’s early free-kick slipped through the grasp of goalkeeper Peter Gulacsi in the 11th minute.
However, Hungary equalised in the 88th minute when Loic Nego, a naturalised Hungarian born in France, pounced to score after Kari Arnason diverted the ball into his path in the box.
And the home side grabbed the winner as Dominik Szoboszlai’s fine low effort sealed a 2-1 victory in the second minute of injury time.
Twice World Cup runners-up, Hungary ended a 30-year major tournament absence when they went to Euro 2016 and reached the last 16.
They will go into Group F at the Euro and will come up against World Cup holders France, Germany and reigning European champions Portugal, with two group games at home in Budapest.
Pandev strike sinks Georgia
North Macedonia will make their tournament debut after veteran 37-year-old striker Goran Pandev scored their winner in the 56th minute in Tbilisi.
A member of the Inter Milan side that won the 2010 Champions League, Pandev is now with Genoa and is his country’s all-time top goal-scorer.
The Balkan nation, who sit 65th in FIFA’s world rankings, will go into Group C alongside the Netherlands, Austria and Ukraine.
North Macedonia had never come close to reaching a major tournament before but were given a chance after the new UEFA Nations League offered a route to Europe’s traditional minnows.
One qualifying place was set aside to a team from the bottom League D, and North Macedonia topped a group with Armenia, Gibraltar and Liechtenstein before beating neighbours Kosovo 2-1 in the play-off semi-finals last month.
The delayed, 24-team Euro is set to be played in 12 cities across the continent, with the semi-finals and final at Wembley in London.