The man, named in court as Jorge Manuel Mirra Neto Moreira, flew to Chile from the Spanish capital this week but was put on a plane back to Madrid after Chilean authorities detained him at the request of global police agency Interpol.
He appeared before a Madrid high court judge on Wednesday and was released on bail while he awaits an extradition hearing.
Lebanese justice minister Henry Khoury did not immediately respond to a request for comment on whether Lebanon would seek the man's extradition. Extradition processes in Spain can take several months.
Mr Moreira is not allowed to leave Spain. His passport has been taken away and he must appear before authorities on a weekly basis, a Spanish judicial source said.
On August 4, 2020, a fire at a warehouse at the Beirut port spread to a stockpile of tonnes of abandoned ammonium nitrate, a chemical used in fertiliser or industrial explosives.
The resulting blast was one of the largest non-nuclear explosions ever recorded.
An investigation by The National found the ammonium nitrate had been left at the port for several years before the blast and was unloaded from a ship that brought it to Beirut before the owners ran out of money for the onward journey.
Lebanon's NNA news agency said in January last year that Interpol Red Notices had been issued for the Russian captain and owner of the ship that brought the chemicals in, and for a Portuguese trader who examined the cargo at Beirut port in 2014.
The Spanish judicial source said Moreira faced charges of terrorism and possession of explosives, which carries a maximum sentence of life imprisonment. He did not elaborate on the nature of the charges.
A source from Portugal's national criminal investigation police unit PJ said that Moreira had previously appeared before a court in the northern Portuguese city of Porto as a result of the Interpol notice, but the court shelved the case because Lebanon failed to send the required documentation.
The same could happen in Spain if Lebanon does not send the needed documentation, the PJ source said.
Chilean authorities confirmed Moreira was detained at the airport and sent back to Spain due to the Interpol warrant, while Spanish sources did not say why Moreira was not arrested before boarding the flight to Chile.