Russia agreed to resume gas deliveries to war-torn Ukraine through the winter in an EU-brokered, multi-billion dollar deal signed by the three parties in Brussels on Thursday.
In a hard-fought accord the EU hopes will ease the broader crisis over Ukraine, Russia agreed to ensure supplies until the end of March.
"I'm glad that political responsibility, the logic of cooperation and simple economic sense have prevailed," EU Commission chief Jose Manuel Barroso told a press conference.
He hailed the end of a bitter gas dispute that saw Russia cut supplies to Ukraine in June, insisting Kiev pay for deliveries up front.
"There is no reason for people in Europe to be cold this winter," Barroso said, referring to fears that Russia could have turned the Ukraine taps off, disrupting onward supplies to many European Union countries.
Ukraine Energy Minister Yuri Prodan said the "decisions taken today will provide energy security for Ukraine and the EU."
The deal caps two days of marathon talks that had stalled before dawn on Thursday when Russia demanded that the EU first agree with Ukraine how to pay Kiev's outstanding bills and finance gas deliveries through to March.
"The European Commission must reach an agreement with Ukraine over the question of financing," a spokesman for Russian gas giant Gazprom told AFP in Moscow earlier. "Otherwise, negotiations make no sense."
In Kiev, Prime Minister Arseniy Yatsenyuk said he would ask the United States and Germany for "additional financial instruments for Ukraine that would help stabilise the budget and pay our energy bills."
- Deal a 'real breakthrough' -
EU Energy Commissioner Guenther Oettinger called the deal a "real breakthrough" that was reached with cool heads against the backdrop of a seven-month war in eastern Ukraine pitting Kiev against pro-Moscow rebels.
"This is perhaps the first sign of a well-working neighbourhood policy. It is a good message," Oettinger said.
He said the terms of the agreement confirmed the tentative outlines of one he reached earlier in the month whereby Ukraine would pay $3.1 billion by the end of the year to settle a large portion of its outstanding bills to Russia.
In return, Russia agreed a base reference price for deliveries through to March 2015 of $385 (302 euros) per 1,000 cubic metres, a discount of about 100 dollars.
In practice, depending on market conditions and the amounts involved, the prices will likely be slightly lower.
The EU gets about a third of its gas from Russia, of which around half transits via Ukraine, a former Soviet bloc country.
The EU was seeking to avoid a repeat of 2006 and 2009 when Russia halted supplies to Ukraine, disrupting deliveries onwards to Europe during two very cold winters.
In June, several months after the Ukraine crisis began with the popular overthrow of a pro-Moscow president in Kiev, Russia cut supplies again, demanding that Kiev settle its outstanding bills and pay up front for any future deliveries.
"We are convinced that our future relations will be constructive and our agreements fulfilled," Russian Energy Minister Alexander Novak said after the deal.
Gazprom spokesperson Sergey Kupriyanov issued a statement saying: "This is hopefully the start of a new, more constructive chapter in gas relations among the EU, Russia and Ukraine."
- Continued loss of life -
Despite the optimism, there was no immediate sign the deal would lead to progress on the wider crisis.
NATO chief Jens Stoltenberg said the US-led alliance remained vigilant after an upsurge in Russian military activity in European airspace earlier this week.
In response, several NATO countries launched a series of intercepts, meant especially to help reassure east European allies unnerved by Russia's intervention in Ukraine.
Ukraine also said pro-Russia rebels killed seven of its soldiers in eastern Ukraine on Thursday, the highest toll in two weeks.
The latest killings bring the total military deaths for Ukraine to 160 since a ceasefire was agreed in September, while more than 3,700 people have died since the start of fighting in April after Russia annexed Crimea.
The EU has imposed a range of economic sanctions on Russia for its alleged military intervention in Ukraine. Moscow has retaliated with punitive measures of its own.
Member states agreed earlier this week to leave the sanctions in place after a regular review, and on Wednesday condemned Moscow's willingness to recognise upcoming elections in rebel-held areas.
The gas deal marks a dramatic farewell for Barroso who steps down on Saturday to make way for a new commission.