The documents relate to a case in which Yahoo attempted to resist US National Security Agency (NSA) demands for customer information, but its objections were overruled.
The case was subsequently used by the US government to persuade tech companies to co-operate with the NSA’s Prism programme revealed by whistleblower Edward Snowden in June 2013.
Snowden’s revelations linked Yahoo and eight other top technology companies to Prism, prompting Yahoo to call for the publication of the documents.
The internet company says the documents prove that it “objected strenuously” to intelligence agencies accessing its data.
The transcript is also expected to reveal more about how the US government justified the Prism programme.
The US government has been given until 29 July to say how long it will need to prepare the documents for publication, according to the BBC.
Yahoo's legal victory
Under federal law the 2008 ruling and Yahoo's arguments against it have been treated as classified information.
"The directives at issue in this debate are at the centre of a robust national debate represented by countless news articles, a statement from the director of national intelligence and congressional hearings," Yahoo said.
Providing more information would "inform this debate and prevent misunderstandings", the company said.
Legal experts say Yahoo’s legal victory is an historic development and could be an important step towards illuminating the arguments behind Prism.
In granting Yahoo’s request, however, the court that oversees the NSA's surveillance operations retained the right to redact "properly classified information".
Read more about Prism and the NSA
- Security Think Tank: Prism fallout could be worse than security risks
- Security Think Tank: Prism is dangerous for everyone
- Security Think Tank: Prism – Sitting duck or elaborate honeypot?
- NSA surveillance whistleblower reveals identity
- US repeatedly hacked China, claims NSA whistleblower
- FBI spies on internet users
- UK links to US internet surveillance remain unclear
- Technology companies call for more transparency over data requests
- Compliance: The Edward Snowden, NSA program controversy continues
Further legal claims from Microsoft
Microsoft, also linked to Prism by Snowden, has also taken action by calling on US attorney general Eric Holder to allow it and others to share more information about the way they handle national security requests for customer data.
"We believe the US constitution guarantees our freedom to share more information with the public, yet the government is stopping us," Microsoft said in a blog post.
"For example, government lawyers have yet to respond to the petition we filed in court on 19 June, seeking permission to publish the volume of national security requests we have received. We hope the attorney general can step in to change this situation."
Microsoft said there were "significant inaccuracies” in the interpretations of leaked government documents reported in the media.
“We have asked the government again for permission to discuss the issues raised by these new documents, and our request was denied by government lawyers,” the company said.
According to NSA documents seen by the Guardian, the US intelligence services claimed to have worked closely with Microsoft to allow users' communications to be intercepted and to circumvent the company's own encryption.
But Microsoft, Google, Apple and others named in the NSA documents have consistently denied giving the NSA any “direct access” to their systems.