However, the judgment, which was welcomed by privacy advocates, does not rule out obtaining less than a week's worth of such data .
The 5-4 verdict on Friday came in the case of Carpenter vs US, involving American Timothy Carpenter who was convicted in 2013 of stealing from Radio Shack and T-Mobile stores in Michigan and Ohio.
Chief Justice John Roberts voted with the other liberal judges on the nine-judge panel.
"The other addresses a person’s expectation of privacy in information voluntarily turned over to third parties."
He also defined the extent of Friday's ruling. "Our decision today is a narrow one. We do not express a view on matters not before us: real-time (location information) or 'tower dumps' (a download of information on all the devices that connected to a particular cell site during a particular interval).
Chief Justice Roberts said there had been no attempt to disturb any earlier cases, or "call into question conventional surveillance techniques and tools, such as security cameras. Nor do we address other business records that might incidentally reveal location information.
"Further, our opinion does not consider other collection techniques involving foreign affairs or national security."
The FBI tied Carpenter to the crime scenes by obtaining location data for mobile phone over 127 days – a total of 12,898 location points, a daily average of 101.
The data was obtained without a warrant under the Stored Communications Act which allows law enforcement to access such data without a warrant that is based on probable cause.
The case came up for hearing in November 2017 and the government relied on the "third-party doctrine" enshrined in the Fourth Amendment to the US Constitution. It harks back to a 1979 ruling that permitted law enforcement to gain access to a list of phone numbers that a person had dialled.
This was based on the reasoning that once a person dials a number, that information gets handed over to the telecommunications company in question, and is no longer private.
Chief Justice Roberts wrote: "The government’s position fails to contend with the seismic shifts in digital technology that made possible the tracking of not only Carpenter’s location but also everyone else’s, not for a short period but for years and years."
The American Civil Liberties Union, which represented Carpenter, argued that the FBI had violated his Fourth Amendment rights by obtaining such detailed information without a warrant.
Chief Justice Roberts agreed, writing: "Mapping a cell phone’s location over the course of 127 days provides an all-encompassing record of the holder’s whereabouts. As with GPS information, the timestamped data provides an intimate window into a person’s life, revealing not only his particular movements, but through them his ‘familial, political, professional, religious, and sexual associations'."
Carpenter moved to suppress the data, arguing that the FBI's taking the records without a warrant violated the Fourth Amendment.
But this was denied by the District Court and prosecutors used the location data to show that Carpenter’s phone was close to four locations where the robberies occurred at the time they were committed.
This interpretation was upheld by the Sixth Circuit Court, "holding that Carpenter lacked a reasonable expectation of privacy in the location information collected by the FBI because he had shared that information with his wireless carriers".
But Chief Justice Roberts differed with these judgments. "We decline to grant the state unrestricted access to a wireless carrier’s database of physical location information," he wrote.
"In light of the deeply revealing nature of (location information), its depth, breadth, and comprehensive reach, and the inescapable and automatic nature of its collection, the fact that such information is gathered by a third party does not make it any less deserving of Fourth Amendment protection. The government’s acquisition of the cell-site records here was a search under that Amendment.
"The judgment of the Court of Appeals is reversed."