MADRID — For years, people considered him a right-wing extremist for wearing the Spanish flag on a bracelet, explained Angel Muñoz, a 62-year-old chauffeur, standing in central Madrid.

But not anymore, he said, pointing out dozens of Spanish flags outside the apartments around him. Most of them have appeared in recent weeks.

“Now with this thing happening in Catalonia, perhaps they feel a bit prouder to show the flag,” Mr. Muñoz said, referring to the northeastern region’s push for a separate state. That is what the Catalans “have achieved with this referendum,” he added. “Somehow now the rest of Spain feels more united.”

Nationalism has always been a tricky thing for Spain. The dictator Gen. Francisco Franco died in 1975. Only three years afterward did the country embrace a democratic Constitution.