The ceremony, at the capital's Almudena cathedral, was held under tight security. It was the first state funeral held for people outside the royal family in the history of Spain's new democracy, restored after former dictator Francisco Franco died in 1975.
The archbishop of Madrid, Cardinal Antonio Rouco Varela, led the service. He described the attacks as an "unspeakable cruelty.”
"Great pain has filled your lives and those of your families since that black day in which brutal terrorist violence, planned and executed with unspeakable cruelty, ended the lives of your most beloved. From the very first moment -- that of the anguished search and the evitable identification of your loved ones -- your pain became the pain of our dear city of Madrid, of Spain, and very quickly, of the whole world," Varela said.
World leaders attending included British Prime Minister Tony Blair, French President Jacques Chirac, and German Chancellor Gerhard Schroeder. Attending for the United States was Secretary of State Colin Powell.
Authorities say Islamic extremists are the main suspects in the 10 near-simultaneous explosions in Madrid that killed 190 people and wounded more than 1,400 others. It was the worst terrorist attack in a Western country since the 11 September 2001 attacks on the United States.
Spanish police have so far detained 13 suspects -- including 10 Moroccans -- in connection with the bombings. All of the suspects lived in Spain, though the group is believed to have links with the-Al Qaeda terrorist network or other extremist groups.
The main suspect remains Moroccan Jamal Zougam, who allegedly had close ties to Islamist militants and who has been under watch by Spanish, French, and Moroccan agents since 2001. He was arrested two days after the bombings. Charges against him include 190 counts of murder and at least 1,400 counts of attempted murder.
"Great pain has filled your lives and those of your families since that black day."
Former coal miner Jose Emilio Suarez Trashorras, the only Spaniard held so far, is suspected of having supplied the explosives used in the attacks. He reportedly said he told the three Moroccans where to steal the dynamite from but denied knowing how it would be used.
Two Indians are also being held in connection with the bombings. They are accused of belonging to or collaborating with a terrorist group and falsifying documents.
All the suspects have denied involvement in the bombings.
The Barcelona daily "El Periodico" meanwhile reports today that police have found the fingerprints of two of the detained suspects on a truck used to carry the explosives and on a bomb in a backpack that failed to explode.