Miguel Blesa, who has links to senior members of Spain's governing Popular Party, is accused of leaving Caja Madrid saddled with huge losses because of an ill-advised takeover by the lender in 2008 of the City National Bank of Florida, which was caught up in the US subprime mortgage meltdown later that year.
The 65-year-old was held in jail for a night in mid-May and released after posting bail of 2.5 million euros ($3.2 million).
Judge Elpidio Jose Silva on June 5th sent Blesa back to jail without bail citing new evidence in the case.
But on Thursday the judge ordered Blesa's release after a Madrid provincial court annulled a decision to re-open a probe into a loan of €26.6 million ($35.6 million) to Gerardo Diaz Ferran, a former head of the Spanish business lobby who was also a board member of Caja Madrid.
"The release order has been sent. He will be released in the next few hours," a judicial source told AFP.
The probe into the loan had served as the basis of the investigation into mismanagement at Caja Madrid.
Blesa was the first major banking figure to even briefly go behind bars in the course of Spain's banking saga.
He chaired Caja Madrid from 1996 to 2009 and left before the bank was merged with six others to form Bankia as part of a major overhaul of Spain's financial sector.
Bankia was nationalized in 2012, prompting Spain to turn to its eurozone partners for tens of billions of euros of emergency aid to rescue the financial sector.
That bailout fuelled angry popular protests in Spain, where the recession brought on by the financial crisis has driven unemployment above 27 percent.