A judge has dismissed Oracle's key argument in a long-running copyright battle against Google.
The dispute centred over whether the Android-developer should be fined for replicating the function of Oracle's Java software components without paying it for a licence.
Oracle had sought up to $1bn (£653m) in compensation claiming Google was guilty of copyright infringement.
The ruling addresses an issue that had split a jury in a trial last month.
Jurors had been unable to decide whether Google's action should be covered by a "fair use" rule. The judge's ruling that Google had not violated Oracle's copyright means the issue over the fair use doctrine became irrelevant to the case.
Google described the news as "a good day for collaboration and innovation".
Oracle said it would "vigorously appeal the decision".
The case related to Google's use of Oracle's APIs (application programming interfaces). These had been used to let developers write Java-compatible code for its Android system.
APIs are used to let different parts of a program or operating system communicate with each other as well as permitting one application to share content with another.
While Oracle allows anyone to use its Java programming language for free, it had argued the same rule did not apply to related APIs.
Specifically it said Google should have paid a licence before "replicating the structure, sequence and organisation" of the code in 37 Java-related API packages.
In his ruling the judge noted that 97% of the lines of code used in the disputed packages had been rewritten by Google.
He said the case therefore depended on whether Oracle should be given ownership of "any and all ways to implement a function" based solely on the fact it had copyrighted one version.
In other words, that Oracle could copyright an idea rather than just the expression of an idea.
The judge noted that such a "sweeping proposition" had never been established in law, and thus ruled in Google's favour.
However, he stressed that his decision had limited ramifications.
"This order does not hold that Java API packages are free for all to use without licence," wrote Judge Alsup.
"It does not hold that the structure, sequence and organization of all computer programs may be stolen. Rather, it holds on the specific facts of this case, the particular elements replicated by Google were free for all to use under the Copyright Act."
Ben Evans, who helps develop Java's technical specifications as part of the Java Community Process Executive Committee, said he had mixed feelings about the ruling.
But he said the issue had still not been fully resolved and the US should follow a recent EU ruling which made it clear that the functionality of any computer program could not be protected by copyright.
"If this is the prevailing view in US law, it should be encoded so as to be compatible with EU law," Mr Evans told the BBC.
"The technology industry has enough legal uncertainty without having major differences between two of the world's major markets for software.
"There is a risk that platform developers will still feel pressured to create APIs that work in different ways risking the fragmentation of Java where programs written in the language could not be guaranteed to be compatible across Android, Windows, Linux and other operating systems."