The Welsh Assembly has voted to introduce a smacking ban in Wales.
Assembly Members voted 36 to 14 on Tuesday in favour of the Welsh Government bill, which means the country joins 58 other nations including Scotland in ending the physical punishment of children.
Ministers say the legislation will come into force in 2022 after gaining royal assent, but opponents of the new law say it will criminalise parents and increase pressure on already-stretched social services.
The public have been promised an extensive awareness campaign before the implementation of the law.
First Minister Mark Drakeford said "times had changed" and physically disciplining children was no longer a part of modern society.
He said: "I'm proud Wales has taken this step and once again put children's rights at the heart of what we do here in Wales.
"Protecting children and giving them the best start in life should always be our priority.
"Times have changed and there is no place in a modern society for the physical punishment of children.
"Wales joins Scotland in being the first parts of the UK to see through a positive change to this key piece of legislation."
The law change will remove the common law defence of reasonable punishment which is currently available to parental figures if accused of assault or battery against a child.
It is the first divergence of core criminal law between Wales and England, where parents would still be able to legally physically punish a child as long as it is deemed "reasonable".
The Children (Abolition of Defence of Reasonable Punishment) (Wales) Bill was led by Julie Morgan, the deputy minister for health and social services, who said there was "no such thing as a loving smack".
She said: "Physical punishment has no place here in Wales - there is no such thing as a loving smack and no justifiable reason for a big person to hit a little person.
"I'm delighted we have voted to change the law to help protect our children and future generations."
She added: "The change in law will bring clarity for parents, professionals and children that physically punishing a child is not acceptable in Wales."
But opponents of the law change said it would do nothing to help children at risk of being abused and would have a "negative impact" on families.
Dr Ashley Frawley, a sociologist at Swansea University and spokeswoman for the Be Reasonable Wales campaign, said: "The smacking ban bill is simply bad policy.
"It will result in highly negative intervention in good families, increased pressure on beleaguered social services departments and will do nothing to help children who are genuinely at risk of abuse.
"The Government has chosen to ignore a plethora of concerns about this legislation. Sadly, it seems the negative impact of the smacking ban will only be realised when it has come into force."