A federal judge has ordered Internet search engine Google to turn over some search data, including 50,000 web addresses, to the US government.
However, Judge James Ware denied a request that Google hand over a list of people's search requests.
The Justice Department had wanted access to search records to help prevent access to online pornography.
The judge said privacy considerations led him to deny part of the department's request.
"This concern, combined with the prevalence of Internet searches for sexually explicit material, gives this court pause as to whether the search queries themselves may constitute potentially sensitive information," he said in his ruling.
Google lawyer Nicole Wong said it was reassuring that the judge's decision had "sent a clear message about privacy".
"What his ruling means is that neither the government nor anyone else has carte blanche when demanding data from Internet companies," she said.
The ruling said the request for 50,000 web addresses, or URLs, was relevant for use in a statistical study the government is undertaking to defend the constitutionality of its child anti-pornography law.
Earlier, the government had reduced its request to just 50,000 web addresses and roughly 5,000 search terms from the millions or potentially billions of addresses it had initially sought.
"The expectation of privacy by some Google users may not be reasonable," Judge Ware wrote, "but may nonetheless have an appreciable impact on the way in which Google is perceived, and consequently the frequency with which users use Google."
The case has focused attention on the issue of personal information held by Internet companies.
The US Government is seeking to defend the 1998 Child Online Protection Act, which has been blocked by the Supreme Court because of legal challenges over how it is enforced.
It wants the data from the search engines to prove how easy it is to stumble over porn on the net.
Three of Google's competitors in Internet search technology - AOL, Yahoo and MSN - have complied with subpoenas in the case.