All the defendants have pleaded not guilty.
Rabei Osman Sayed Ahmed, one of the four alleged masterminds of the bombings and the first suspect to take the stand, rejected all the charges against him and said he would not give evidence.
Other suspects included Moroccans Jamal Zougam and Abdelmajid Bouchar, both accused of planting bombs.
Spaniard Emilio Trashorras, a former miner, is accused of supplying dynamite, and Youssef Belhadj is suspected of making key decisions about the attack, such as the date and of giving last-minute instructions.
The attack, in which 10 backpack bombs exploded and ripped through four packed commuter trains, has been called Spain's most traumatic event since the 1930s civil war.
Security was extremely tight for the trial, with police on horseback patrolling outside the court on the city's outskirts, and bomb-sniffing dogs searching for explosives.
Testimony was expected to last for more than five months, and a verdict is expected in late October.
The trial marks the culmination of a lengthy investigation, which concluded that the attack was carried out by a homegrown cell of extremists angry over the then-conservative Spanish government's support for the Iraq war and its troop presence in Afghanistan.
The group was inspired by al-Qaeda, but had no direct links to it, nor did it receive financing from Osama bin Laden's organisation, Spanish investigators say.
That government initially blamed Basque separatists, and continued to do so even as evidence emerged to the contrary. This led to charges of a cover up, and in elections three days after the attack Socialists were voted into power. They quickly brought Spain's troops home from Iraq.
Spain has since raised its three-stage alert level to the middle rung as a precautionary measure.