The world’s governments will meet in Madrid this December to discuss the climate emergency, it has been confirmed, after a last-minute intervention by the Spanish government to save the talks.

The conference had been set to take place in Santiago, Chile, but the government of President Sebastian Pinera decided on Wednesday to call it off because of the unrest in the capital. Scores of people have been killed and injured in weeks of rioting over economic inequality and social problems.

After Chile withdrew, there was concern that the annual talks might have to be scaled down, postponed or even abandoned.

However, on Friday afternoon, the UN’s top official on climate change, Patricia Espinosa, issued a terse statement that COP25 would go ahead on the original dates, 2-13 December, but in Madrid.

Scientific warnings have become increasingly insistent that time is running out to reduce greenhouse gas emissions and stave off the worst damages of global heating. But international negotiations under the UN have been slow and plagued by upsets and backsliding, such as the US plans to withdraw from the Paris agreement, Brazil’s rejection of its commitments by President Jair Bolsonaro, and the rise of political populism in other regions.

Katherine Kramer, the global climate lead at Christian Aid, said: “It’s a shame that COP25 won’t be held in Latin America to highlight some of the grave climate impacts that affect the region. But hopefully a Madrid summit will be able to keep those in mind. Credit should be given to the Spanish government for offering to help at such short notice … but it shows how important countries view the UN process for tackling climate change that they are prepared to do all they can to keep the talks on track.”

Tasneem Essop, the interim executive director of the Climate Action Network, made up of many NGOs with an interest in the issue, said: “We hope all steps are going to be taken … to make access to this COP fair and inclusive. It is important that there is the full participation of climate activists and observers from different parts of the world to COP25 where important negotiations on the Paris agreement are due to be undertaken.”

Some activists who had set sail for Chile from Europe were planning to continue their journey. Others, particularly those from smaller organisations and delegations from poor countries, were likely to find it hard to meet the costs of the venue change.

Greta Thunberg, the Swedish climate activist who sparked the global student strikes, had travelled as far as Los Angeles without flying and was planning to continue to Santiago in time for the conference. On Friday she made a plea for help getting back to Europe in time for the conference.

“It turns out I’ve travelled half around the world, the wrong way,” she tweeted. “Now I need to find a way to cross the Atlantic in November … If anyone could help me find transport I would be so grateful.”

This year’s talks are essential to putting the 2015 Paris agreement into practice and to pave the way for a crunch conference in the UK next year at which the long-term response to the climate emergency will be decided. Many of the world’s national commitments to cut greenhouse gases are pegged to a 2020 deadline, and if new commitments are to be set then next year will be crucial.