The case centered on a uniquely-different warrant that was issued by US prosecutors in that it was for data stored in an email account stored by Microsoft overseas. Prosecutors said that because the data was hosted by a US-based company, Microsoft must comply.
But the judges concluded that Congress did not intend the law used in the case -- the Stored Communications Act -- to apply outside the US.
Judge Gerard Lynch said in added remarks it was a "rational policy outcome" and should be "celebrated as a milestone in protecting privacy".
"The warrant in this case may not lawfully be used to compel Microsoft to produce to the government the contents of a customer's email account stored exclusively in Ireland. Because Microsoft has otherwise complied with the warrant, it has no remaining lawful obligation to produce materials to the government," the ruling said.
A spokesperson for the Justice Department would not say if it would appeal the ruling.
"We are disappointed with the court's decision and are considering our options. Lawfully accessing information stored by American providers outside the United States quickly enough to act on evolving criminal or national security threats that impact public safety is crucial to fulfilling our mission to protect citizens and obtain justice for victims of crime," said spokesperson Peter Carr.
The software giant has been battling US prosecutors for two years over data held in its Dublin, Ireland datacenter, which it said cannot be accessed or retrieved by a US search warrant.
Both Microsoft and Irish authorities have long asked the US government to go through the international mutual legal assistance treaties set up between the two countries.
Realizing the implications, a number of companies filed "friends of the court" briefs in Microsoft's defense. Verizon submitted an amicus brief in Microsoft's support, concerned that its overseas data could also be at risk. Apple, AT&T, and Cisco also lent their support.
Microsoft president Brad Smith said in a statement that he "welcomes" the decision.
"The decision is important for three reasons: it ensures that people's privacy rights are protected by the laws of their own countries; it helps ensure that the legal protections of the physical world apply in the digital domain; and it paves the way for better solutions to address both privacy and law enforcement needs," said Smith.
The American Civil Liberties Union (ACLU), which also filed a brief in support of Microsoft, said that the "significant decision" was "yet another reminder" that the laws need updating.
"As the concurring opinion points out, our online privacy laws are not the bulwarks of privacy that Congress thought they were when it enacted them in 1986," said ACLU attorney Alex Abdo.
"Now is the time for Congress to finally pass reform protecting our privacy in the digital age," he said.