This article is more than
6 year oldJudge Joao Pedro Gerbran Neto rejected a decision taken by the judge on call on Sunday, Rogerio Favreto.
Mr Favreto had said the politician should be freed from jail while he appeals a 12-year sentence for corruption and money laundering.
Lula says he is innocent and the case is politically motivated.
His conviction was part of an anti-corruption investigation known as Operation Car Wash, which has implicated top politicians from several parties.
Judge Favreto's announcement came after members of Lula's Workers Party challenged his jailing in an application on Friday.
"With all due respect, [Mr Favreto] has absolutely no qualified authority to override the decision," said Federal Judge Sergio Moro, who has been the driving force behind Operation Car Wash.
He told police to wait for clarification on the legal impasse.
Judge Joao Pedro Gerbran Neto then stepped in and overruled the decision, ordering police and jail authorities not to take any action.
Lula, who led the country from January 2003 to December 2010, is a divisive figure.
Thousands of people took to the streets earlier this year to call for his immediate imprisonment, while his supporters also turned out in large numbers to insist he should be freed.
His jailing was controversial as defendants in Brazil were previously allowed to remain free until their final appeal had been exhausted.
However, the Supreme Court sided with a 2016 ruling from a lower court, under which defendants could be sent to jail after a failed first appeal.
Many political analysts say Lula will be disqualified from standing for the presidency again because of his criminal conviction.
But this did not stop his supporters launching a campaign with an event last month.
The electoral court will make an official decision in August on whether he can run.
Polls conducted before Lula was jailed in April suggested he was the frontrunner for October's presidential elections.
In 2014, after Lula left office, prosecutors started investigating allegations that executives at the state oil company Petrobras had accepted bribes in return for awarding contracts to construction firms.
He was convicted of receiving a renovated beachfront apartment worth some 3.7m reais ($1.1m; £790,000) as a bribe by engineering firm OAS.
The defence says Lula's ownership of the apartment has never been proven and that his conviction rests largely on the word of the former chairman of OAS, himself convicted of corruption.
Lula lost his first appeal in January, when the appeals court not only upheld his conviction but increased the sentence from nine-and-a-half years to 12.
Newer articles
<p>The deployment of Kim Jong-un’s troops has added fuel to the growing fire in recent weeks. Now there are claims Vladimir Putin has put them to use.</p>