Diab became the first senior politician to testify before judicial authorities, who are not entitled to question incumbents in government or parliament without recourse to a special body.
The premier who resigned in the wake of the August 4 blast that left more than 190 dead had said it was caused by 2,750 tonnes of fertilizer ammonium nitrate stored in a portside warehouse for years.
Judge Fadi Sawan listened to Diab’s testimony in his “capacity as a witness,” a judicial source told AFP.
Sawan was seeking to determine “how long he knew as prime minister of the presence of ammonium nitrate in the port,” according to the source.
He also wanted to find out “why he did not instruct the government to take measures to remove the dangerous (substance) after receiving reports from security services.”
On July 20, Diab and President Michel Aoun both received a report from the State Security agency warning of the danger posed by the highly unstable material.
After the explosion, the agency confirmed it had alerted authorities in a detailed report quoting a chemical expert who had visited the warehouse.
If ignited, the ammonium nitrate would cause a huge explosion that would be especially destructive to the port, warned the report seen by AFP.
Lebanese authorities have launched their own investigation after rejecting calls for an international probe.
Twenty-five suspects have so far been arrested, including port director-general Hassan Koraytem and customs chief Badri Daher.
Also among those arrested are three Syrian workers who carried out welding work on the warehouse on the day of the blast.
Security sources have suggested the work could have started a fire that triggered the blast, but some observers have rejected the theory.
The Lebanese army said Thursday it has found another 4.35 tonnes of ammonium nitrate stored inside containers at an entrance to the port.