The government backed down on plans to introduce compulsory ID cards for anyone living in the United Kingdom. The compromise means only those applying for a passport will need the ID card.
The vote was 310 to 279 in favour of the compromise.
Monday's compromise followed pressure from rebels within the Labour party.
A vote on compulsory ID cards for all citizens will require a separate bill.
Tony Blair, the prime minister, had intended to return from a summit in South Africa to vote for the plan. However, he was delayed by a problem with his aircraft.
Voluntary not mandatory
A close vote had been expected in the House of Commons. Even before the compromise, the House of Lords inserted an amendment to make the cards voluntary instead of mandatory.
Critics say that, despite the changes, the ID cards are still being forced on the public.
"If you apply for a passport or a renewal, you are required to purchase one. So that's not voluntary at all"
Doug Jewel from Liberty, a civil rights group that organised a protest outside parliament, said: "The government is trying to persuade people to believe it's a voluntary scheme, but if you apply for a passport or a renewal, you are required to purchase one. So that's not voluntary at all."
Phil Booth, co-ordinator of the NO2ID campaign, said people would be required to provide information in 52 categories.
"The home secretary does not even believe ID cards could have stopped the [July 7] attacks because the bombers had proper identification and made no attempt to hide their identity."
The cost of ID
David Davis, the spokesman on law and order for the opposition Conservative party, had complained before the vote that the government had not produced estimates of costs.
Davis said: "The idea that you can't leave the country without having your name put on a national identity register is an interesting idea of voluntary. We want to make it really voluntary. This is a creeping compulsion."
Gordon Brown, the Chancellor of the Exchequer, said: "The central issue here is the right to your own identity, that your identity should be secure and it shouldn't be stolen and it should be protected."
"This is a creeping compulsion"
Conservative party spokesman
Brown told the BBC that biometric systems were increasingly being used by banks and credit card issuers to ensure security.
"I think people generally accept that for entry to the country with passports, it is right to use the most modern and sophisticated and secure means of identity."