Pakistan's Senate passed a bill that for the first time criminalizes sexual assault against minors, child trafficking and pornography.
The amendment to the penal code, which will go into force after being ratified by the president, also raises the age of criminal responsibility from seven to 10 years old.
Under the legislation, sexual assaults will now be punishable by up to seven years in prison. Previously, only rape was illegal.
Also, child pornography, which was previously not mentioned in the law, will be punishable by seven years in prison and a fine of 700,000 rupees ($7000).
Pakistan in August was hit by a major pedophilia scandal when hundreds of pornographic videos of children from the village of Hussain Khanwala in Punjab province were found in circulation.
About 20 arrests were made. But at the time, only the acts of rape and sodomy were illegal.
The new amendment also criminalizes child trafficking within Pakistan. Previously traffickers were only liable for punishment if they removed children from the country.
"This is a very important step to realize the obligations of Pakistan" under the Convention on the Rights of the Child, Sara Coleman, UNICEF's child protection chief, told AFP.