After a two-year investigation, Judge Juan Del Olmo concluded that the attacks on March 11, which killed 191 people and injured about 2,000 others, were carried out by a local Islamist cell inspired by, but not directed by, al-Qaeda.
Del Olmo charged five people with 191 counts of terrorist killings and 1,755 attempted murders, while another 23 people were charged with collaboration. Each count of terrorist murder could carry a sentence of up to 30 years.
Jose Emilio Suarez Trashorras, a former miner who provided the bombers with plastic explosives, was charged with 192 murders, including the death of a policeman killed during a raid on suspected bombers a few weeks after the attacks.
In the raid, another seven suspects blew themselves up in an apartment block in Madrid, and another fled from Spain and died fighting in Iraq.
In comments on the 1,471-page report, a court spokeswoman said the Islamist cell had been inspired by an Islamic essay published online.
"It took its inspiration from a website that called on local Islamists to stage attacks in Spain before the 2004 general elections to prompt withdrawal of troops from Iraq," she said.
In the immediate aftermath of the bombs, which were packed into sports bags and detonated by mobile phones, the then-ruling conservative party, the Partido Popular (PP), blamed the attacks on the Basque separatist group ETA.
As mounting evidence indicated that the attacks were the work of militant Islamists, Spanish voters turned against the PP and the country voted in the socialist government of Jose Luis Rodriguez Zapatero in general elections, three days after the bombs.
Zapatero quickly pulled Spanish troops out of Iraq, as he had promised in the run-up to the vote.
The court spokeswoman said there was no connection between the bombings and ETA, which called a truce last month.
Given the complexity of the case, the terror trial may not start until early next year.