SAN JOSE, California - The U.S. Justice Department on Tuesday sharply cut its demand for Google Inc. customer data and a U.S. judge signalled he intended to require the search company to hand over some records, potentially opening the door to compromise in a test case for Web privacy.

U.S. District Court Judge James Ware told a hearing he would make a decision that weighed the government's need to gather data against Google's needs as a private company to defend its trade secrets.

Ware added that he was concerned about creating the perception that Google's users' privacy could be undermined, but he reacted positively to the reduced request by the government, which is seeking data for a study on Internet child pornography.

"It is my intent to grant some relief to the government," said Ware of the U.S. District Court for the Northern District of California, adding that he expected to make a decision "very quickly."

Shares of Google's stock rose $14.10, or 4.2 percent, to close at $351.16.

The government on Tuesday reduced the number of Google searches it wanted data on to just 50,000 Web addresses and roughly 5,000 search terms from the millions or potentially billions of addresses it had initially sought.

In a statement after the hearing, Nicole Wong, Google's associate general counsel, said her company was encouraged by concerns voiced by the judge over Google users' privacy and the scope of the government's subpoena in a civil action.

"When the government was asked to justify their demand they conceded that they needed much less," Wong said.

Google acknowledged that the government's scaled-down request was less of a threat to customers' privacy even as it said the smaller set of data was also of limited use to the government's study.

Google seeks to quash a demand by U.S. Attorney General Alberto Gonzales for data that the government wants the company to produce as part of the Bush Administration's attempt to defend the effectiveness of an online pornography law.

The issue boils down to whether the information from Google is necessary to the Bush administration's case or "does nothing to further the government's case in the underlying action," Google's legal motion opposing the government demand argued last month.

The Justice Department's demand for a random sample of Google search data has raised concerns over how far customers can trust Google to protect the privacy of their search habits from government snooping and highlighted the limited legal protections for Web user data under 20-year-old U.S. laws.

In the first court hearing on the subpoena, the judge repeatedly questioned the necessity of the original government request, which the Internet search leader had rejected.

Other Internet companies including Time Warner Inc.'s America Online, Microsoft Corp. and Yahoo Inc. complied with the government demand and submitted data for the government study.

"The information that they seek tells them nothing about any issue in the case," argued Albert Gidari, Google's outside counsel with the law firm of Perkins Coie LLP in Seattle.

Google also opposes the government's request for data on the grounds it is being asked to reveal details on how its market-dominating search system operates.

The government wants the search terms to test the effectiveness of filtering systems designed to protect children from sexually explicit material on the Internet.