King Felipe VI presided over the annual military display, which took place this year under the cloud of the Catalan government's threat to declare independence after it pushed ahead with a banned secession referendum on October 1 in defiance of Madrid.
Flag makers have reported a surge in demand for the Spanish flag in a country where nationalism is associated with the dictatorship of General Francisco Franco, whose authoritarian rule still haunts Spain.
"I love to see people waving our national flag," said Beatriz Trapero, who was watching with her husband and carried a small flag she bought from one of the many street vendors hawking Spain-themed souvenirs on the parade route.
"There used to be a certain shyness in showing it but now it seems not so much. I hope it continues, that it is not just now."
While there have always been Spanish flags at the annual parade on Spain's national day, which commemorates Christopher Columbus's first arrival in the Americas in 1492, this year there were far more than usual.
People draped flags around their waists or wore them as capes and they hung from many of the balconies of apartment blocks lining the parade route.
The theme of this year's parade was "Proud to be Spanish".
"Its very emotional seeing all the flags. We have to remain together," said Andrea Corrales, a 46-year-old secretary who came to the parade with her husband and two young daughters.
One man held up a large Spanish flags with the message: "Long live the unity of Spain".
- 'Deserve our support' -
At one point a small group of people who were watching the parade from an apartment balcony began to chant: "Catalonia is Spain!" People on the ground looked up but did not join in and they stopped chanting.
The crowd cheered as members of La Legion, an elite unit of the Spanish Army, paraded by with their mascot, a goat named Rocco.
But the biggest applause was reserved for members of Spain's national police force, which has come in for criticism over its violent response to the October 1 independence vote in Catalonia.
The crowd cheered loudly when a national police 4x4 drove slowly by with a black police dog on its hood as well as when national police helicopters flew overhead.
"They did what they had to do, they deserve our support," said 67-year-old retired teacher Alberto Luis Buzo.
The national police were taking part in the annual parade for the first time in decades. The government said they had been invited to participate months ago and their presence was not related to their actions during the Catalan referendum.