Scotland's ban on smacking has been hailed as a "momentous day for children's rights".
Children's campaigners were among those who welcomed the passage of the Children (Equal Protection from Assault) (Scotland) Bill at the Scottish Parliament.
The legislation, brought forward by Green MSP John Finnie, gives children the same protection from violence as adults by removing the defence of justifiable assault in Scots law.
It will come into force within 12 months of the Bill gaining Royal Assent.
What happened yesterday: Scotland to ban smacking of children
Psychologists: Smacking harms mental health, psychologists warn
Criminalising children: Move to raise criminal age to 14 or 16 is rejected
Sweden became the first country in the world to ban smacking in the home when it outlawed corporal punishment in 1979, with Scotland now the 58th nation to do so.
Scotland's children's commissioner Bruce Adamson welcomed the move, saying: "Assaulting a child for the purpose of punishment should never be legal and this important law change brings Scotland into line with its international human rights commitment to provide children with comprehensive legal protection from violence."
Dunja Mijatović, the commissioner of human rights at the Council of Europe, also welcomed the vote.
She tweeted: "I congratulate the Scottish Parliament for adopting the law to give children equal protection from assault. There is no place for violence in a child's life. This law is a good step towards the full realisation of children's rights in the country."
Joanna Barrett, of children's charity NSPCC Scotland, said: "This historic vote delivers a UK first in fairness and equality for children which the NSPCC has long championed.
"It's a common-sense move that closes an archaic loophole and ensures that, finally, children in Scotland will have the same protection from assault as adults."
Martin Crewe, director of charity Barnardo's Scotland, described it as "a momentous day for children's rights".
He thanked Mr Finnie for his "dedication and passion" in pushing the bill forward, and said: "We look forward to seeing similar legislation passed in the Welsh Assembly and hope that this progress can be mirrored across the other nations of the UK, too."
Mary Glasgow, chief executive of the charity Children 1st, said: "This is a defining moment for Scotland.
"Again and again people have told us about the lifelong impact of being hit as a child, as they've joined the campaign to change the law.
"Today's vote protects every future generation of Scotland's children from any and all levels of physical violence. Families will be stronger and communities will be safer.
"Once again Scotland is leading the rest of the UK in doing what's right for children – our most precious and vulnerable citizens."
Medical professionals and religious leaders also welcomed the bill, which was passed by 84 votes to 29.
Professor Steve Turner, of the Royal College of Paediatrics and Child Health, said: "The Scottish Parliament has ensured equal protection for children across Scotland from assault.
"Scotland is the first country in the UK to provide children with the same rights as adults – it is not legally justifiable to use violence against adults, it will not be for children either."
Richard Frazer, convener of the Church of Scotland's Church and Society Council, said: "The passage of this bill gives children the same legal protection as adults, acknowledging that children are valuable as they are and not simply as adults in training.
"We hope that the positive change marked today will enable children and families to continue to flourish and grow as equal members of our communities."
The Law Society of Scotland stressed that now the bill has been approved, the Scottish government must mount a "comprehensive campaign" to raise awareness of the change in the law.
Morag Driscoll, the organisation's family law subcommittee convener, said: "The reasonable chastisement defence attracted criticism from international children's rights organisations. However, Scotland is now sending a clear message that all forms of assault against children are unacceptable.
"Driving meaningful behavioural change requires much more than changing the law. The Scottish government now needs to launch a comprehensive public education and awareness campaign to alert people to these changes."