Within days of taking office, the messages had started piling up in Teresa Ribera’s inbox. The country’s first ever demography minister (the official title is deputy prime minister for the ecological transition and the demographic challenge) was left in no doubt as to the size of the task ahead to reverse Spain’s flight from rural areas.

“Maybe the scariest but most exciting thing is the sheer scale of the expectation that the creation of this ministry has generated,” Ribera said. “In the first 48 hours after it was announced, I was deluged by really interesting messages: from small, medium and large towns, from historic towns, creative towns, from farmers, from women, from cooperatives, from rural tourism outfits, from mobile pharmacies – from just about everyone.”

Ribera is not a fan of the phrase la España vaciada (the hollowed-out Spain), which is used to describe the huge areas of the country that suffer from depopulation, underinvestment and dwindling services – and which are consequently fading from the map. But she is adamant that Spain’s new government, a coalition between the Spanish Socialist Workers’ party (PSOE) and the far-left, anti-austerity Unidas Podemos, will do all it can to reverse a decades-old trend and narrow the gulf between urban and rural areas.

“We need to make sure whoever wants to stay in, or return to, a rural area should be able to do so without losing out on quality of life or services,” she said. “We can’t ask people to undertake heroic efforts just to do that: they need a guaranteed minimum of services and support so that their lives aren’t a kind of torture.”

Spain made huge strides during the rush to modernise and develop between the 1950s and 1970s as it pushed itself to catch up with its western European neighbours. “You’ve got to remember that at the beginning of the 1970s there were still a lot of villages that didn’t have sanitation, or access to decent drinking water or electricity, and some of whose inhabitants were illiterate,” said Ribera.

Play Video 6:32 'Europe's one big scam': original drama from Spain - video

But in the same drive rural areas were abandoned as people left the countryside for jobs in big cities or in the booming tourist resorts along the coast. Rural schools closed down, teachers and doctors left and, bit by bit, communities dissolved.

Spain’s population statistics these days are stark: 90% of its people – about 42 million – are squeezed into 1,500 towns and cities that occupy 30% of the land. The other 10% (4.6 million people) occupy the remaining 70%, giving a population density of barely 14 inhabitants per square kilometre.

It is part of a wider European story of youth “deserts”, whole regions that young people have left for the greater promise of cities, capitals or even foreign lands.

The issue is a headache for Brussels, which has appointed its own demography commissioner to confront a trend that risks sowing antagonism between haves and have-nots and fuelling populism.

In Spain, perhaps the most pernicious effect of the depletion, argues Ribera, is the way in which it has given rise to the idea that the smartest young people leave rural areas while others are left behind.

“There’s been a social trend that has fed an incredibly dangerous sense that there are first-class and second-class citizens,” she said. “If we allow that to grow then we’re attacking one of the principal and most basic elements of our democracy. We’re feeding very dangerous trends when it comes to people’s trust in their institutions’ ability to create opportunities and solve problems.”

Facebook Twitter Pinterest Teresa Ribera (L), acknowledges there are no quick fixes. Photograph: Juan Carlos Hidalgo/EPA

Despite the evident divide – not to mention the recent protests by farmers who feel undervalued and under-remunerated for their work – Ribera senses a change. When thousands of people rallied in Madrid almost a year ago to defend “the rural world and its traditions”, their protests won widespread support.

Although the far-right Vox party has sought to appoint itself guardian of all that is rural and Spanish, its overtures were rebuffed by farmers on the protest.

In a country where – as Ribera puts it, “everyone has an uncle or a cousin in the countryside, or spends the weekend there, or has roots there” – there is a general feeling that the issue crosses party lines and can no longer remain invisible.

“There’s a very stark divide between ‘the full Spain’ and ‘the empty Spain’. People who feel left behind are those who are most likely to look for false alternatives because they’ve lost trust in their institutions. That’s a problem.”

The government is looking at a range of measures, some national, some local, to redress the balance. As well as improving digital connectivity, encouraging ecotourism and diversification away from agriculture, it is also looking into regional industrial hubs and rolling out mobile schools, doctors’ surgeries and pharmacies.

Q&A This is Europe: a new Guardian series Show Hide This is Europe is a new stream of Guardian journalism that investigates the big challenges that transcend national boundaries, and seeks out the solutions that could benefit us all. These are testing times, and crises are not limited by national borders. But then neither are we.

Photograph: Guardian Design

On Friday, as the government’s cross-cabinet committee for the demographic challenge held its inaugural meeting – in La Rioja, 185 miles (300km) north of Madrid – Ribera pledged to work “to avoid a country that moves forward at different speeds and to leave no one behind”.

But she acknowledges there are no quick fixes and that the government’s success or failure will hinge on patience, perseverance and listening to those who have long felt marginalised and excluded.

“I’ve already told the prime minister that these demographic trends won’t be solved by the end of the legislature,” she said. “It’s about shifting and redirecting a lot of the unbalanced and stunted structural trends of the past few decades.”

As Ribera’s father has pointed out, the new ministry’s name belies its massive remit. “He’s a geriatrician and he was absolutely furious. He said to me: ‘You’ve given it the wrong name! My colleagues and I know it’s not about that. The demographic challenge is something else. What you’re talking about is a geographical and territorial challenge – not a demographic one.’”