The US government cannot force Microsoft to give authorities access to the firm's servers located in other countries, a court has ruled.
The decision is being seen as a precedent for protecting the privacy of cloud computing services.
The US Department of Justice had wanted to access a server in Ireland, as part of an investigation into a drugs case.
The ruling, made by an appeals court, overturns an order granted by a court in Manhattan in 2014.
The DoJ said it was disappointed by the decision and was considering what it would do next. If it appeals, the case could then move to the US Supreme Court.
Microsoft said it welcomed the ruling.
"It makes clear that the US government can no longer seek to use its search warrants on a unilateral basis to reach into other countries and obtain the emails that belong to people of other nationalities," Brad Smith, president and chief legal officer, of Microsoft told the BBC.
"It tells people they can indeed trust technology as they move their information to the cloud," he said.
Microsoft thanked the companies that had backed its appeal, which included the likes of Amazon, Apple and Cisco.
Another of Microsoft's backers was the Open Rights Group, a UK-based organisation that campaigns for digital rights.
"The US Court's decision has upheld the right to individual privacy in the face of the US State's intrusion into personal liberty," the group's legal director Myles Jackman said on Thursday.
"As a consequence, US law enforcement agencies must respect European citizens' digital privacy rights and the protection of their personal data.
"States should not arbitrarily reach across borders just because they feel they can bully companies into doing so."
Microsoft had warned that allowing the search warrant to be conducted could open up a global privacy "free for all". Other countries, the company said, would perhaps seek to apply their own search warrants to servers located in the US.
Echoing a constant concern of those in tech industry, Microsoft said the laws were simply too outdated to be effective.
"The protection of privacy and the needs of law enforcement require new legal solutions that reflect the world that exists today - rather than technologies that existed three decades ago when current law was enacted."
But there is continued concern in the law enforcement community that cloud storage, together with encryption, is providing something of a safe haven for criminals.
Judge Susan Carney ruled against the DoJ on the basis that the Stored Communications Act of 1986 limited the reach of warrants applicable outside the US. She noted that such restrictions were vital to maintaining good relations with other nations.
Furthermore, she said there were mechanisms available for co-operation between countries in investigations - though law enforcement agencies often complain that this route is more expensive and time-consuming.
"Going to court to seek a Stored Communications Act (SCA) warrant is normally a quicker path than dealing with international resolution channels," explained Daniel Stoller, senior legal editor at Bloomberg Law Privacy & Security News.
He said the initial decision in 2014 interpreted the SCA in a way that favoured the DoJ's view. But the appeals court prioritised international law in its ruling.
Another judge involved in the ruling, Gerard Lynch, said the 1986 law was in urgent need of an update.
"I concur in the result," he wrote. "But without any illusion that the result should even be regarded as a rational policy outcome, let alone celebrated as a milestone in protecting privacy."