The lower house of parliament's vote in a final reading was 202 in favour, 141 against and 2 abstentions. Until now, helping someone end their life in Spain carried a jail term of up to 10 years.
"Today is an important day: we are heading towards the recognition of human rights. We are heading towards a more humane and fair society," Health Minister Carolina Darias told lawmakers.
The law, available for adults with legal residence in Spain, will take force in three months to give time to set up regional control committees which will review and authorise requests.
Outside the parliament, groups for and against the bill demonstrated during the debate and the vote.
The new legislation faces staunch opposition from the hard right and religious groups. The far-right Vox party has said it will challenge the law before the Constitutional Court.
Euthanasia has long grabbed public attention in Spain, which has the world's fourth-highest life expectancy, and more notably so since paralysed man Ramon Sampedro recorded his assisted suicide in 1998 after being denied that right by courts.
His story was taken to the screen in the Academy Award-winning 2004 film "The Sea Inside".
Almost 90% of Spaniards are in favour of decriminalising euthanasia, according to a 2019 opinion poll.
Rafael Botella, a 35-year-old Spaniard paralysed from the neck down since a car crash at 19, told Reuters before the vote that he was relieved that the law would give him the option in case he needed it.
"If for some reason someone is tired of living, no one has the power to tell him, 'No, you will live because my voters or my ideology tell the contrary'," Botella said.
Belgium, Luxembourg and the Netherlands have already legalised euthanasia. A similar plan in neighbouring Portugal suffered a setback on Monday when the country's top court rejected as unconstitutional a bill approved by parliament.
To be able to write a comment, you have to be registered and logged in
Currently there are no comments.