The chief justice acknowledged that barring searches would affect law enforcement, but said: "Privacy comes at a cost."
The court chose not to extend earlier rulings that allow police to empty a suspect's pockets and examine whatever they find to ensure officers' safety and prevent the destruction of evidence.
The Obama administration and the state of California, defending the cellphone searches, said cellphones should have no greater protection from a search than anything else police find.
But the defendants in these cases, backed by civil libertarians, librarians and news media groups, argued that cellphones, especially smartphones, are increasingly powerful computers that can store troves of sensitive personal information.
"By recognizing that the digital revolution has transformed our expectations of privacy, today's decision is itself revolutionary and will help to protect the privacy rights of all Americans," American Civil Liberties Union legal director Steven Shapiro said.
In the cases decided Wednesday, one defendant carried a smartphone, while the other carried an older flip phone.
Roberts said the comparison to packages of cigarettes and other items that were at issue in the earlier cases is not apt.
A ride on horseback and a flight to the moon both "are ways of getting from point A to point B, but little else justifies lumping them together," he said.
Authorities concerned about the destruction of evidence can take steps to prevent the remote erasure of a phone's contents or the activation of encryption, Roberts said.
One exception to the warrant requirement left open by the decision is a case in which officers reasonably fear for their safety or the lives of others.
The two cases arose following arrests in San Diego and Boston.
In San Diego, police found indications of gang membership when they looked through defendant David Leon Riley's Samsung smartphone. Prosecutors used video and photographs found on the smartphone to persuade a jury to convict Riley of attempted murder and other charges. California courts rejected Riley's efforts to throw out the evidence and upheld the convictions.
The court ordered the California Supreme Court to take a new look at Riley's case.
In Boston, a federal appeals court ruled that police must have a warrant before searching arrestees' cellphones.
Police arrested Brima Wurie on suspicion of selling crack cocaine, checked the call log on his flip phone and used that information to determine where he lived. When they searched Wurie's home and had a warrant, they found crack, marijuana, a gun and ammunition. The evidence was enough to produce a conviction and a prison term of more than 20 years.
The appeals court ruled for Wurie, but left in place a drug conviction for selling cocaine near a school that did not depend on the tainted evidence. That conviction also carried a 20-year sentence. The administration appealed the court ruling because it wants to preserve the warrantless searches following arrest.
The justices upheld that ruling.
Here's the full court opinion in Riley v. California: