Spain needed an injury-time goal from Rodrigo to book their place at Euro 2020 with two matches to spare.
They fell behind to Sweden four minutes into the second half after Spain goalkeeper David De Gea made a double save to deny Berg and Emil Forsberg, only for the ball to loop up in the air for Berg to nod into an empty net.
Moments later De Gea had to pull off a sharp save down to his right to prevent Forsberg from doubling the lead.
But Spain’s problems deepened when De Gea, who had made a stunning save to deny Robin Quaison in the first half, limped off with what appeared to be a hamstring injury.
They looked on course for a first defeat of the campaign until substitute Rodrigo fired through a crowded penalty area at the death to clinch a 1-1 draw.
Sweden were left grateful to Alexander Sorloth, who scored a late equaliser for Norway in Romania.
The 1-1 draw means Romania stay a point behind the Swedes in third, while the Faroe Islands beat fellow Group F also-rans Malta 1-0.
As Ireland lost 2-0 in Gineva, elsewhere in Group D, minnows Gibraltar came from 2-0 down to level against Georgia only to fall to Giorgi Kvilitaia’s late goal.
Italy, already assured of qualification, took the lead in after just two minutes in Liechtenstein through Federico Bernardeschi.
But they had to wait until the 70th minute to find the net again through Andrea Belotti’s header before Alessio Romagnoli, Stephan El Shaarawy and Belotti again wrapped up a 5-0 win.
Norwich striker Teemu Pukki scored twice in a comfortable 3-0 victory over Armenia. Pukki struck twice in the second half after Fredrik Jensen opened the scoring for the hosts, who are second behind Italy in Group J.
A late own-goal by Adnan Kovacevic dented Bosnia and Herzegovina’s chances of catching Finland as they went down 2-1 in Greece. In Group G Israel beat whipping boys Latvia 3-1.