Spain is to shut down most of its coalmines by the end of the year after government and unions struck a deal that will mean €250m (£221m) will be invested in mining regions over the next decade.

Pedro Sánchez’s new leftwing administration has moved quickly on environmental policy, abolishing a controversial “sunshine tax” on the solar industry, and announcing the launch of Spain’s long-delayed national climate plan next month.

Unions hailed the mining deal – which covers Spain’s privately owned pits – as a model agreement. It mixes early retirement schemes for miners over 48, with environmental restoration work in pit communities and re-skilling schemes for cutting-edge green industries.

Teresa Ribera, the minister for ecological transition, said: “With this agreement, we have solved the first urgent task we had on the table when we came to government. Our aim has been to leave no one behind. We also want to go further, we want to innovate. That is why we offer the drawing up of ‘Just Transition’ contracts, with the aim of helping the regions to consolidate the employment of the future.”

Coal faces: the last miners in Spain – in pictures Read more

More than a thousand miners and subcontractors will lose their jobs when 10 pits close by the end of the year. Almost all of the sites were uneconomic concerns that the European commission had allowed Spain to temporarily keep open with a €2.1bn state aid plan.

Montserrat Mir, the Spanish confederal secretary for the European Trades Union Congress, said the “just transition” model could be applied elsewhere.

“Spain can export this deal as an example of good practice,” she said. “We have shown that it’s possible to follow the Paris agreement without damage [to people’s livelihoods]. We don’t need to choose between a job and protecting the environment. It is possible to have both.”

Facebook Twitter Pinterest Spanish coalminers will be offered early retirement. Photograph: Emilio Morenatti/Associated Press

About 600 workers in Spain’s northern mining regions – Asturias, Aragón, and Castilla y León – are set to benefit from social aid under the scheme, while about 60% of the miners will be able to opt for early retirement.

Laura Martin-Murillo, a government negotiator, described the pact as “the end of a process of restructuring for many communities that has been going on for decades. It had to be done sensitively to bring hope to places that sometimes have lost faith that it could work. A lot of young people abandoned these areas, and they experienced a change in identity.”

We need a fossil fuel non-proliferation treaty – and we need it now | Andrew Simms and Peter Newell Read more

Negotiations with the last few hundred miners employed in publicly owned mines would begin now, she added. “We will look at the same just transition plans for those workers,” she said.

Spain’s coal industry employed more than 100,000 miners in the 1960s, but its energy dominance was eroded by cheap imports and increasing awareness of the industry’s environmental, health and climate costs. National coal provides just 2.3% of Spain’s electricity.