Last week, and not for the first time, Juan Manuel Sánchez Gordillo found himself in the Spanish headlines. Dubbed "Robin Hood" by El Pais, Sánchez Gordillo, the mayor of a small town in rural Andalusia, led farm labourers into supermarkets to expropriate basic living supplies: they filled trolleys with pasta, sugar, chickpeas and milk, left without paying, and distributed the loot to local food banks. His reasoning was blunt: "The crisis has a face and a name. There are many families who can't afford to eat."

It's hard to overstate how close to the brink Spain is at the moment. Unemployment is at 25% nationally (higher than Greece), 34% in Andalusia and 53% for 16-to-24-year-olds; miners in Asturias are firing homemade rocket launchers at riot police; repossessions and the collapse of the construction industry have left 800,000 empty homes, and, last May, the 8 million-strong indignados protest movement, a forerunner of Occupy, announced its total lack of faith in parliamentary democracy to solve any of these problems. And this is just the phoney war: last month, the prime minister, Mariano Rajoy, announced spending cuts of ¤65bn (£51bn) over the next two years.

In the heart of it all, like Asterix's village in Gaul implausibly holding out against the Romans, is Sánchez Gordillo's town, the self-described communist utopia of Marinaleda. With a population of 2,600, the town has virtually full employment, communally owned land and wage equality. Over the past three decades, the townspeople have built 350 family homes with their own hands. Residents pay a "mortgage" of just ¤15 a month towards their homes, but have no opportunity to profit from selling them on.

When you first arrive, Marinaleda looks the same as any small town in rural Andalusia, with olive groves stretching towards a dusty horizon, children kicking footballs against worn stone walls and parasols fluttering gently outside tapas bars. Soon, you begin to notice the little differences: the lack of advertising or brand names, the streets named for Fermín Salvochea, the 19th-century anarchist mayor of Cadiz, and for Salvador Allende, Federico García Lorca and Pablo Neruda.

In the mayor's office hangs a framed portrait of Che Guevara, along with three flags: one for Andalusia, one for the Spanish Second Republic (the elected government displaced by Franco's military coup), and one sporting the red, white and green of Marinaleda itself; it's very clean, and endearingly untidy. In one corner is a flip-chart covered with semi-legible marker pen scribbles, bullet points and wonky arrows; this, it transpires, is the town's budget.

Sánchez Gordillo was born in Marinaleda in 1949; back then, he explains, it was a town of migrant workers. "They would go to Germany, or France; or for two months a year, to the wheat fields to the north, to look for work. Otherwise, they were unemployed. It was misery. The surroundings were all huge expanses of private land. Andalusia is like Latin America: 2% of property owners own 50% of the land."

After Franco's death in 1975, Marinaleda began struggling towards its own definition of freedom. Organising around a new trade union, a new workers' party, and with weekly mass meetings, the townspeople began occupying some of the land around the village, owned – and unused – by the Duke of Infantil. The police would arrest or evict them, and they'd start all over again. They blocked roads, broke into and shut down Malaga and Seville airports, marched on Madrid, and went on mass hunger strike. Sánchez Gordillo has been to jail seven times, and survived two assassination attempts by rightwing extremists.

After 12 years of persistent struggle, with 1992's Seville World Expo just round the corner and the regional authorities' resolve finally weakening, incredibly, they won, securing 1,200 hectares of the duke's land for their farming cooperative.

"Our union gathers people of many political stripes," Sánchez Gordillo explains, "but we carry the torch of anarchism's direct action." He cites 5,000 years of Andalusian struggle for land, and thinks for a moment. "Even the weekly assembly is direct action."

The town's relationship with the state is complicated. They are still subject to Spanish electoral law (Sánchez Gordillo is re-elected with a huge majority each time), but have abolished their police force. "By law, due to the number of inhabitants we have here, we should have around four to seven cops," he tells me. "But we don't want police here. Because we have our voluntary work, because we fight together, because we make our lives together, there is a high degree of coexistence. When we plant trees, we do it together too." Sánchez Gordillo's articulation of what "community" can mean is striking, when you consider how blithely the word is used by politicians across the west.

"Utopias aren't chimeras, they are the most noble dreams that people have. The dream of equality; the dream that housing should belong to everyone, because you are a person, and not a piece of merchandise to be speculated with; the dream that natural resources – for instance energy – shouldn't be in the service of multinationals, but in the service of the people. All those dreams are the dreams we'd like to turn into realities. First, in the place where we live, with the knowledge that we're surrounded by capitalism everywhere; and later, in Andalusia, and the world."

Leaving the gleaming white town hall building and departing into the dusk, you find a metal arch spelling out the slogan OTRO MUNDO ES POSIBLE. Another world is possible. In Marinaleda, the words represent not an aspirational mirage, but a statement of fact.

• Adapted from Utopia and the Valley of Tears: A journey through the Spanish crisis, an ebook available from amazon.co.uk from 20 August.