The government sought the information from Yahoo under the National Security Agency's PRISM data-gathering program. Details of the secret program were disclosed by former NSA contractor Edward Snowden, who has fled the U.S.
The program came to light in early June after The Washington Post and Guardian newspapers published documents provided by Snowden. It allows the NSA to reach into the data streams of U.S. companies such as Yahoo, Facebook, Microsoft, Google. and others, and grab emails, video chats, pictures, and more. U.S. officials have said the program is narrowly focused on foreign targets, and technology companies say they turn over information only if required by court order.
Yahoo requested in court papers filed June 14 to have the information about the 2008 case unsealed. A Yahoo spokeswoman hailed Monday's decision and said the company believes it will help inform public discussion about the U.S. government's surveillance programs.
(Read more: CNBC Uncharted: Marissa Mayer one year later)
The government hasn't taken a position on whether details of the case should be published as long as it's allowed to review the documents before publication in order to redact classified information, according to the court order.
Mark Rumold, a staff attorney at the Electronic Frontier Foundation specializing in electronic surveillance and national security issues, called the ruling incremental and said he was reserving judgment until the case details are actually released.
"It remains to be seen how forthcoming (the government) will be," Rumold said. "The administration has said they want a debate about the propriety of the surveillance, but they haven't really provided information to inform that debate. So declassifying these opinions is a very important place to start."
The unsealing of such secret rulings is not unprecedented, but it is rare. The last time that happened, Rumold said, was in 2002, in a case regarding the Patriot Act.
(Disclosure: CNBC has a content-sharing partnership with Yahoo's finance site.)