Spain’s new Socialist government is trying to strike a balance between its green ambitions and its red traditions.

With only a tenuous hold on power, the minority Socialist government can't afford to offend Spain's small but militant coal mining sector, but that risks going against the party's green commitments.

Coal is only a marginal employer — the number of miners has plummeted from 13,000 in 1994 to only a little above 2,000. But for miners in the remaining coal enclaves — Asturias, Aragón, and Castilla y León — the coal exit favored by incoming Environment Minister Teresa Ribera is a life-or-death issue that could lead to a blowback against Prime Minister Pedro Sánchez's government in next year's series of elections.

By the end of this year, 26 uncompetitive mines will have to shut down.

"The party that changes energy policy in this region is implicitly changing industrial policy and heading toward a disaster and a loss of voters' confidence," said José Luis Alperi, leader of the Asturian mining trade union SOMA.

Asturias is a Socialist stronghold, and SOMA calculates that every coal miner supports 3.5 related jobs in industry and services.

Three Brussels deadlines

The Sánchez government faces a delicate balancing act over coal, and the pressure comes from Brussels.

By the end of this year, 26 uncompetitive mines will have to shut down, or else return the aid they received under a €2.1 billion EU-approved plan to ease their closure. Meanwhile, power plants burning fuels such as coal, biomass or peat have until June 2020 to comply with the EU's newly revised Industrial Emissions Directive, which mandates stricter pollution limits.

Finally, Spain has to draft its national energy and climate plan by the end of this year, as part of the EU's climate and energy targets for 2030.

Hanging over these tricky decisions is the Socialists' tenuous hold on power — they rule thanks to a ramshackle coalition, and the conservatives of recently ousted Prime Minister Mariano Rajoy are waiting for them to trip up.

Miners are hoping the deadline to keep marginal mines operating will be extended. "It's not a cut-off date for us. If there is political will, this date can be overcome," said Alperi.

But Ribera has made up her mind. "The mining chapter has been closed before we came [to power]. It is a sterile debate that creates needless friction," she told Spanish daily El País.

Spanish utilities have been announcing plans to shut down coal-powered power plants. The previous conservative government objected, and in January proposed a law giving the government power to block their closure.

Despite its old ties to coal mining unions, the new government has changed course and is reassuring utilities wanting to go green. The energy portfolio was taken away from the industry ministry and given to Ribera, who says she has "serious doubts over [coal-powered plants'] economic viability past 2030."

Endesa, Spain's largest utility and a subsidiary of Italy's Enel, reacted by saying it plans to close its two remaining coal-fired power plants by 2020. Iberdrola has also notified the government of its intention to shutter its two coal-powered plants by the same date.

Spain will aim to reduce emissions by 20 percent compared to 1990 levels — which means halving emissions from today's levels, Ribera told the Spanish parliament on Wednesday, and by 90 percent by 2050. "If we don’t succeed in 2030 … it will be very difficult to achieve our 2050 objective," she said.

Coal accounts for 58 percent of emissions from the energy sector, and getting rid of coal-powered plants would be an easy win for Ribera, but that means a wholesale restructuring of its energy model.

Spain's new government has been promoting a greener agenda in Brussels, helping last month's push for higher renewable energy targets of 32 percent by 2030. But back at home, renewables account for only 17.3 percent of Spain's energy supply, well below the country's 2020 target of 20 percent.

"If this suite of proposals is delivered in full, Spain's energy mix will undergo a radical change in the space of only a few years," argued consultancy Wood Mackenzie in an emailed statement, adding that "these changes remain at the proposal stage, and will most likely face opposition."

Breaking historical ties

Indeed, rifts with "coal barons" — Socialist leaders in mining regions — are already showing.

Javier Fernández, president of Asturias region, is campaigning to defend his home turf. "Asturias is not a proud village romanticizing its past," he said, pledging to defend coal-powered stations from closure. Javier Lambán, president of Aragón, expressed similar positions.

That's a problem for the central government as campaigns for next year's regional, local and European elections heat up.

"The impact in terms of electorate is relatively small, but in political terms it can be a trigger," said Diego Crescente, an analyst with Mas Consulting Group.

Ribera plans to meet with workers, miners and local authorities this summer to discuss future steps, and promised to present a draft law on climate change and the ecological transition, which will tackle the question of coal, before August 1.

"We have to open the window to the new century, let the sun and fresh air in," Ribera, whose ministry declined to comment for this article, said in Congress.

Meanwhile, it is still unclear precisely when Spain will have its next general election, which must happen by 2020 at the latest. That gives Sanchez's Cabinet less than two years to formally present the climate change law, negotiate a compromise with other parties and commit Spain to an ecological transition that would last beyond its term in power.

"The magical recipe would be to bet on renewables," said Crescente. Selling a job-creating green energy transition could allow the Socialist Party to break its historical ties with coal with minimum of collateral damage.

"Everything will start from a recognition of coal's role in Spain, and a solution for mining areas," said Crescente.