Brazil's Congress passed an Internet privacy law which is similar to a web-user's bill of rights.
The move follows the news that the US had been spying on Brazil's president Dilma Rousseff for no other reason than it could.
The bill sets out principles, guarantees, rights, and duties for internet users, and internet service providers and aimed at balancing freedom of expression and the web-users' rights to privacy and protection of personal data.
The legislation, dubbed Brazil's "Internet Constitution," has been hailed by experts, such as the British physicist and World Wide Web inventor Sir Tim Berners-Lee, for balancing the rights and duties of users, governments and corporations while ensuring the internet continues to be an open and decentralised network.
The legislation protects freedom of expression and information, establishing that ISPs will not be liable for content published by users, but they must comply with court orders to remove offensive or libellous material.
The bill also limits the gathering and use of metadata on internet users in Brazil.
Instead, the bill says companies such as Google and Facebook will be subject to Brazil's laws and courts in cases involving information on Brazilians, even if the data is stored on servers abroad.
Rousseff has spoken out forcefully against cyber-snooping revealed by US intelligence whistleblower Edward Snowden. The US eavesdropping targeted her staff's communications and those of others at Petrobras, the state oil giant.
She was so piqued by the snooping that she cancelled a state visit to Washington scheduled for October and pushed for a UN resolution aimed at protecting "online" human rights.