The private members bill, brought by Julie Morgan (Labour, Cardiff North) will ban children and teenagers from using sunbeds in England and Wales when it becomes law next year.
There has been a ban on sunbed use in Scotland since May 2008.
Sunbed use has been shown to raise the risk of malignant melanoma.
Cancer Research UK, which had pursued a campaign calling for a ban, said it was ‘thrilled' at the passing of the bill.
Aisling Burnand, executive director of policy and public affairs at the charity, said: ‘This is a monumental achievement and legislation will go a long way to curb the alarming numbers of teenagers that use sunbeds.'
Research recently published in the BMJ found that a quarter of a million children in England between the ages of 11 and 17 regularly use sunbeds.
Mr Burnand added: ‘Sunbeds are classified at the same carcinogenic level as tobacco, with the intensity of some UV rays from sunbeds being up to 10-15 times higher than that of the midday sun.'
Younger people are particularly at risk and sunbed users under the age of 35 have a 75% higher risk of developing malignant melanoma, the deadliest type of skin cancer, the charity said.