European Union leaders meeting in Brussels have agreed to make the currently 28-member bloc carbon neutral by 2050.
However Poland, which is heavily reliant on coal, remains opposed and has been exempted for the time being.
European Council President Charles Michel admitted that it was more difficult for some countries and regions to adapt.
He said the EU would continue to work to convince Poland to support the deal.
Several eastern European countries wanted financial and other guarantees before they agreed to the EU cutting to zero its net amount of greenhouse gas emissions.
The Czech Republic and Hungary were brought on board after assurances that nuclear energy could be included in the final mix.
On Thursday, the EU's new executive unveiled a €100bn (£84bn; $110bn) European Green Deal for the net-zero greenhouse gas emissions target.
European Commission President Ursula von der Leyen described it as Europe's "man on the Moon" moment.
The EU summit came as UN climate talks in Madrid, COP25, were due to wrap up on Friday.
There are fears that a final statement of ambition from COP25 may be watered down, with major decisions put off until a key meeting in Glasgow at the end of 2020.
What was decided in Brussels?
After 10 hours of debate, a joint statement from the summit said that the European Council endorsed the objective of achieving a climate-neutral EU by 2050.
Without naming Poland it said that "one member state, at this stage, cannot commit to implement this objective" but said the European Council would return to the issue next June.
The statement acknowledged the right of member states to make their own decisions on energy production, saying that some had "indicated that they use nuclear energy as part of their national energy mix".
On funding the transition, the council welcomed an announcement by the European Investment Bank (EIB) - the EU's lending arm - that it would provide €1tn of investment in climate action and environmental sustainability from 2021 to 2030.
At a news conference, Mr Michel acknowledged that the transition would be more difficult for some member states.
"We took this decision with respect for many concerns of different countries because we know that it's important to take into consideration the different national circumstances and also different starting points," he said.
Nothing worth having comes easy... But we did it!— Charles Michel (@eucopresident) December 13, 2019
The EU will be Climate Neutral by 2050. 🇪🇺🌍 pic.twitter.com/2NelLmAV1Z
Polish Prime Minister Mateusz Morawiecki said it had been a "difficult negotiation" but welcomed his country's exemption.
"This rule that must also be included in the legislative process, the rule that Poland would be reaching climate neutrality at its own pace," he said.
The UK did not take part in the summit and is due to leave the European Union at the end of January. However, earlier this year the government unveiled plans to cut UK greenhouse gas emissions to net-zero by 2050.
What is the EU's plan?
The European Green Deal includes:
- A €100bn Just Transition Mechanism to help countries still heavily dependent on fossil fuels and "carbon-intensive processes" to move to renewable energy sources
- Proposals to reduce greenhouse gas emissions to 50% of 1990 levels or even lower by 2030 - instead of the current target of a 40% cut
- A law that would set the EU "on to an irreversible path to climate neutrality" by 2050
- A plan to promote a more circular economy - a system designed to eliminate waste - that would address more sustainable products as well as a "farm to fork" strategy to improve the sustainability of food production and distribution
What is climate neutrality?
Climate neutrality involves balancing emissions by removing warming gases from the atmosphere.
Warming emissions created by cars and power plants are counteracted by removing greenhouse gases from the air by planting new forests or through carbon capture technologies that bury CO2 underground.