Temer was arrested on Thursday accused of leading a "criminal organisation" that facilitated up to 1.8 billion reais (US$469 million) in bribes through various kickback schemes.
Judge Ivan Athié said in his ruling that the evidence provided by prosecutors does not justify Temer’s "preventive" jailing.
"You have here old facts, involving possibly illegal acts, but no evidence of repeated criminality after 2016 or any other factor that justifies preventive imprisonment," wrote Athié.
The decision reverses Judge Marcelo Bretas ruling last week that Temer and seven other defendants should be held so they could not destroy evidence, a practice revealed in previous Lava Jato inquiries.
It led some critics to question Athié’s integrity in his decision making. The judge was previously removed from office for seven years on charges of conspiracy and gang formation.
Federal prosecutors said they will appeal the decision. They have claimed Temer’s criminal organization includes a counterintelligence unit that can monitor and hinder official investigations making his imprisonment vital.
“These facts add to the appearance of a criminal organization in full operation,” they said in a statement.
Over 150 powerful politicians and businessmen have been convicted since 2014 in connection with Brazil's Lava Jato probe, also known as the Car Wash investigation.
Temer, who was president from 2016 to 2018, is the third successive leader prior to Jair Bolsonaro to be ensnared by the probe. Dilma Rousseff was impeached and removed from office in 2016 while Luiz Inacio Lula da Silva is currently serving a 12 year prison term.