Switzerland, as the hosts, and Uruguay, as the defending champions, qualified automatically, leaving 14 spots open for competition.
Spain and Turkey finished level on points, and a play-off on neutral ground was played to decide who would qualify.
Luigi Franco Gemma, a 14-year-old Italian boy whose father worked at the stadium, picked Turkey's name from the lots with his eyes blindfolded.
Since the 1970 FIFA World Cup finals, goal difference has been used as a tiebreaker for future qualifying rounds.
Poland withdrew and Iceland had their entry rejected so Hungary qualified automatically.