The attacks, the first blamed on the Basque separatist organization ETA since it called off a 14-month cease-fire in early December, came in the midst of Spain's general election campaign and dashed any lingering hopes for an end to the long-running Basque conflict.
Chants of "Murderers, murderers," occasionally erupted from the crowd. Many carried banners with slogans that read "ETA No." Government officials estimated the crowd at 1.1 million people, about a third of Madrid's population.
Prime Minister Jose Maria Aznar, opposition leaders and former heads of government led the solemn procession though the heart of the Spanish capital.
It was the largest anti-ETA demonstration since 1997, when six million people joined in protests across the country against the killing of Basque town councilor Miguel Angel Blanco, which marked a turning point in the fight against the rebels.
ETA, whose name stands for "Basque Homeland and Freedom," has not claimed responsibility for Friday's attack, but many say the attacks bore the group's hallmark.
The guerrillas, blamed for about 800 deaths in their three-decade-long struggle, called off their truce after the Spanish government continued a police crackdown and refused to discuss its demand for Basque independence.
Most leaders have roundly condemned Friday's attacks, but ETA's political wing has placed the blame on Spain and France for refusing to negotiate the creation of a Basque state straddling the two countries' borders.
Aznar, caught in the midst of campaigning for a March 12 general election, has vowed to maintain his hardline stance. "It's a long, hard struggle for all of us," Aznar told reporters. "We will suffer but in the end we will triumph."
Political analysts said that if ETA's return to arms was intended to undermine Aznar's re-election chances, it was more likely to have the opposite effect by rallying support behind his center-right government.
Despite that, a poll conducted the same day as the bombings showed 50 percent of Spaniards in favour of reopening peace talks, which ETA broke off last August, while 29 percent believed police measures could end the conflict.
Joining the chorus of international condemnation, Pope John Paul told pilgrims in St Peter's Square that the bombings "placed in serious danger the efforts of those who are seeking just and peaceful solutions."