Swiss voters have approved the introduction of biometric passports - by the narrowest of margins.
Official final results show 50.14 per cent voted in favour. A separate initiative promoting alternative medicine won 67 per cent approval.
The result of the biometric passport vote was for several hours too close to call. And although it was passed, a majority of cantons - including Bern, Geneva, Basel City and Ticino - said no.
In the end just over 5,500 votes separated the two sides.
Turnout was low at 38 per cent.
The controversial new travel document will include the holder's electronic photograph and two fingerprints.
Members of the European single border area, including Switzerland, are required to introduce new biometric passports by next March. The new document should also allow visa-free entry into the United States.
The referendum came about after a broad political coalition challenged parliament's decision to adopt the new passport - in line with the European Union - and set up a fingerprint register.
Young people were the driving force behind the referendum, collecting signatures through a cross-party online campaign.
Centre-left politicians had dismissed government assurances that the data would not be used in criminal investigations.
The Social Democrats and Greens had the backing of the rightwing Swiss People's Party as well as the youth chapters of other political groups.
Data protection officials and information security specialists had also warned of abuse by hackers and the illegitimate use of data by police and other state agencies.
Opponents on the right were concerned that the new travel document could enable the state to interfere in the private sphere of citizens.
Justice Minister Eveline Widmer-Schlumpf, who led the "yes" campaign, argued electronic passports were a way to prevent abuse. She had the backing of the main centre-right parties and the Swiss expatriate community.
The government claims the new travel document is sufficiently protected against forgery and abuse and the central fingerprint database will help speed up passport procedures.
Switzerland has issued 3.9 million passports since 2003. Some 13,000 are reported lost every year.
The government also pointed out that the electronic passport would help ensure travel freedom for Swiss citizens.
The Swiss Business Federation and the tourism industry warned that a rejection by voters would harm the key export industry and could discourage non-European tourists from visiting Switzerland.
Alternative medicine was given a boost on Sunday when the electorate gave wholehearted backing to an initiative requiring complementary forms of medicine to be covered by obligatory health insurance.
Alternative forms of medicine - including homeopathy and traditional Chinese medicine - are very popular in Switzerland, and approval had been expected.
Final results showed a 67 per cent approval rate and the backing of all cantons.
Opponents had unsuccessfully argued that including these forms of treatment would put more financial strain on the health system.
The rightwing Swiss People's Party was the only major party to reject the proposal.