By Anthony Boadle

BRASILIA (Reuters) - Brazil's lower chamber of Congress approved groundbreaking legislation on Tuesday aimed at guaranteeing equal access to the Internet and protecting the privacy of its users in the wake of U.S. spying revelations.

To ensure passage of the bill, the government had to drop a contentious provision that would have forced global Internet companies to store data on Brazilian servers inside the country.

The rule was added last year to proposed Internet governance legislation after revelations that the U.S. National Security Agency had spied on the personal communications of Brazilians, including those of President Dilma Rousseff.

Instead, the bill says companies such as Google Inc and Facebook Inc are subject to Brazilian laws and courts in cases involving information on Brazilians, even if the data is stored on servers abroad.

The government refused to drop another a key provision on net neutrality that was opposed by telecom companies because it bars them from charging higher prices for different content, such as video streaming and voice services such as Skype.

The legislation dubbed Brazil's "Internet Constitution" protects freedom of expression and sets limits to the gathering and use of metadata about Internet users.

Experts, such as World Wide Web inventor Tim Berners-Lee, have praised the bill for balancing the rights and duties of individuals, governments and corporations, while ensuring the Internet continues to be an open and decentralized network.

Following the spying revelations by former NSA contractor Edward Snowden, including allegations that the NSA secretly collected data stored on servers by Internet companies such as Google and Yahoo Inc, Brazil sought to force them to store data on Brazilian servers in the country.

Internet companies complained that would push up their costs and create barriers to the free flow of information.

Those with offices in Brazil have been fined for not complying with Brazilian laws, but it is not clear how companies based elsewhere can be made to comply, for instance, with court orders to remove disputed content from the Internet.

Story continues

"The law is balanced because it protects Internet access and privacy at the same time," said lawyer José Nantala, with the Peixoto e Cury law firm in Sao Paulo. "But it doesn't resolve the problem of jurisdiction in international cases," he said.

The revelations of NSA espionage using powerful surveillance programs upset relations between the United States and Brazil and led Rousseff to cancel a state visit to Washington in October and denounce massive electronic surveillance of the Internet in a speech to the U.N. General Assembly.

Rousseff and German Chancellor Angela Merkel, another leader allegedly spied on by the NSA, have led international efforts to limit mass electronic surveillance. Brazil will host a global conference on the future of Internet governance next month.

(Reporting by Anthony Boadle; Editing by Ken Wills)