Pakistani President Asif Ali Zardari has issued a decree making internet crime punishable with death or imprisonment with heavy fines.
The law will be enforced with retrospective effect from 29 September, the official APP news agency said.
It defines any cyber crime that causes a death as "cyber terrorism", which will be punishable with death or imprisonment for life.
Pakistan has more than 10 million internet users.
According to the law, the offender, whether a person, group or organisation, will be deemed to have committed "cyber terrorism" if they access a computer, electronic system or an electronic device with a view to engaging in a "terroristic act".
The law defines a terroristic act as an attempt to "alarm, frighten, disrupt, harm, damage or carry out an act of violence" against people or the government.
According to the law, "cyber crime" also includes "stealing or copying" classified information or data required to make chemical, biological or nuclear weapons.
It says the mere intent - before the crime is actually committed - would also constitute a crime.
The law prescribes various durations of imprisonment and fines for other crimes, such as cyber fraud, stalking and spamming.
A similar decree issued by former President Pervez Musharraf in December 2007 was widely criticised by legal experts as being vague and therefore contrary to basic rights.