Spaniards staged massive, peaceful demonstrations throughout the country tonight to reaffirm Spain's rejection of military rule and its determination to defend its fledgling democracy.

Just four days after Spain hung on a knife's edge between a military coup and representative government, an estimated million demonstrators marched outside the national parliament building where on Monday night military rebels took control of the chamber at gunpoint and held it for 18 hours.

Huge crowds lining the route of the march shouted, "Democracy Yes; Dictatorship No" and took up the chant, "The people united will never be defeated." Shortly before the Madrid demonstration started, four bombs, planted by rightists, exploded in garbage cans and under cars near the Prado Museum. The blasts caused no injuries and did not deter the demonstrators, who started to file past the Prado on their way to the parliament building about two hours later.

Turnouts of more than half a million people were reported in Spain's second city, Barcelona, and in Valencia, where military rebels had declared a "state of emergency" to back up the takeover of parliament, authorities said 150,000 took to the streets today. Similar demonstrations were held in every town. They were organized by political leaders representing a wide parliamentary spectrum from Communists to conservatives.

The rallies were intended as a mass rejection of the coup attempt and a necessary boost for the democratic institutions. The huge numbers confounded claims that "a silent majority" would have passively supported a military takeover and isolated the insurgents from the Spanish people.

Spanish commentators said that there had never been a civic demonstration here of such magnitude. Cheering onlookers and marchers alike represented a broad cross section of society and age groups.

The bombs in Madrid were the only serious incidents reported and even these appeared to make no impact on the crowds. A right-wing terrorist group called the Basque-Spanish Battallion later claimed responsibility for the explosions in a telephone call to the national news agency.

There were no new announcements of arrests connected with the coup attempt today, and the number of generals removed from their commands and detained stands at four. As more details of the planning and execution of Monday's events emerged in the media, it became increasingly evident that many officers had prior knowledge of the coup. What has particularly concerned Spaniards is that among those implicated are officers who were considered loyal.