But the court said DNA molecules engineered by man -- including so-called "cDNAs" -- are eligible for patents.
"To be sure, it found an important and useful gene, but separating that gene from its surrounding genetic material is not an act of invention."
Synthetic "cDNA" does not present the same obstacles to patentability as naturally occurring isolated DNA segments, Thomas wrote.
Myriad acknowledged the court's ruling that five of its claims covering isolated DNA were not patent eligible. But Myriad "has more than 500 valid and enforceable claims in 24 different patents conferring strong patent protection for its BRACAnalysis test," the Salt Lake City, Utah-based company said in a statement today.
The court today adopted a middle-ground position that the U.S. government had put forward.
"Today, the court struck down a major barrier to patient care and medical innovation," said Sandra Park, senior staff attorney with Women's Rights Project of the American Civil Liberties Union, which had challenged the patents.
But less than 1 percent of women actually have a BRCA mutation, making costly genetic testing unnecessary for most.
Click here to find out if you should be tested for BRCA gene mutations.
The American Medical Assocation said it welcomed the ruling.
"The U.S. Supreme Court's unanimous rejection of patenting human genes is a clear victory for patients that will expand medical discovery and preserve access to innovative diagnosis and treatment options," the AMA said in a statement today.
Professor Lori Andrews of the Illinois Institute of Technology Chicago-Kent College of Law said, "Today's decision allows any doctor or scientist to use the breast cancer gene for diagnosis or treatment. This means all genetic tests will become affordable and more researchers will be able to look for cures."
Andrews filed a brief opposing Myriad's patent but says that biotechnology companies will be adequately protected if they genetically engineer a product.
Because of the patents, Myriad is the only place in the United States to go for diagnostic testing at a $3,340 price tag.
Myriad's lawyers had fiercely defended its patents, arguing that they have been essential to the development of diagnostic tools to help patients and doctors assess the risks of cancer.
ABC News' Josh Hafenbrack and Katie Moisse contributed to this report.