MARINALEDA, Spain  The people of this small Andalusian town have never been shy about their political convictions. Since they occupied the estate of a local aristocrat in the 1980s, they and their fiery mayor, Juan Manuel Sánchez Gordillo, have been synonymous in Spain with a dogged struggle for the rural poor.

Now that Spain’s real estate bust is fueling rampant unemployment, this Communist enclave, surrounded by sloping olive groves, is thumbing its nose at its countrymen’s capitalist folly. Attracted by its municipal housing program and bustling farming cooperative, people from neighboring villages and beyond have come here seeking jobs or homes, villagers and officials say.

Mr. Sánchez, a bearded 53-year-old who this month celebrated three decades as mayor of the town of 2,700, says the economic crisis proves the wisdom of his socialist vision.

“They all thought that the market was God, who made everything work with his invisible hand,” Mr. Sánchez said on a recent morning, seated in his office below a portrait of Che Guevara. “Before, it was a mortal sin to talk about the government having a role in the economy. Now, we see we have to put the economy at the service of man.”