Media playback is unsupported on your device Media caption The deal will secure gas supplies to EU countries via Ukraine

Russia has agreed to resume gas supplies to Ukraine over the winter in a deal brokered by the European Union.

The deal will also ensure gas supplies to EU countries via Ukraine are secure.

"There is now no reason for people in Europe to stay cold this winter,'' said European Commission President Jose Manuel Barroso.

European Union energy chief Guenther Oettinger said he was confident that Ukraine would be able to afford to pay for the gas it needed.

He added that the agreement might be the "first glimmer" of hope in easing tensions between Russian and Ukraine.

We can say to the citizens of Europe that we can guarantee security of supply over the winter. Guenther Oettinger, EU Energy Commissioner

"This is an important step for our shared energy security in the European continent," Mr Barroso said.

The deal follows months of talks between EU officials and the Russian and Ukrainian energy ministers.

The terms include the EU acting as guarantor for Ukraine's gas purchases from Russia and helping to meet outstanding debts.

The total package is worth $4.6bn (£2.87bn), with money coming from the International Monetary Fund as well as the EU. The total includes funds from existing accords with the EU and IMF.

"Unprecedented levels of EU aid will be disbursed in a timely manner, and the International Monetary Fund has reassured Ukraine that it can use all financial means at its disposal to pay for gas," the EC said in a statement.

"Further work with the international financial institutions on financial assistance to Ukraine, also in relation to gas supplies, will still continue. But all three sides are reassured that Ukraine will have the necessary financial means."

Winter urgency

Gas supplies were halted over late payments when Russia scrapped subsidies given to Ukraine for importing gas, meaning the price paid by Ukraine rose sharply.

Image copyright Reuters Image caption Gazprom chief Alexei Miller (left) shakes hands with Ukrainian state gas company Naftogaz head Andriy Kobolev after the agreement was signed

However, the backdrop to the row is Russia's conflict with Ukraine and Western sanctions on Moscow.

I want to reassure you that Russia has always been a reliable supplier of energy resources to Europe and other consumers. Alexander Novak, Russia's energy minister

Although the impact of the gas ban has been relatively small, the onset of winter made the need for a deal more urgent.

Alexander Motyl, professor at Rutgers University-Newark, said the deal was "good news for Ukraine because there was a distinct possibility that the population wouldn't have enough heat for the winter."

The agreement was also good news for European consumers, he told the BBC. However, he said it was too early to tell whether the deal might herald a breakthrough in Russian-Ukraine relations.

Ukraine has relied on Russia for around 50% of its gas. Despite storage facilities Ukraine has a winter shortfall of around 3 billion to 4 billion cubic metres of gas, analysts say.

Russia provides around a third of the European Union's gas, about half of which is pumped via Ukraine.

Russia's Energy Minister Alexander Novak told a news conference that the deal secures supplies for Ukraine and Europe.

"I want to reassure you that Russia has always been a reliable supplier of energy resources to Europe and other consumers. It has been, is and will be a reliable supplier.

"The autumn and winter period is safe (for Ukraine) and the supply to European consumers is also stable. We are convinced that our future relations will be constructive and that our agreements will be fulfilled," he said.

Upfront payments

Ukraine's Prime Minister Arseniy Yatseniuk said that the EU had agreed to serve as guarantor for the gas price Kiev would pay to Russia.

Ukraine will pay $378 per 1,000 cubic metres to the end of 2014, and $365 in the first quarter of 2015.

Mr Yatseniuk said Kiev was ready to pay off debts for gas immediately after any deal was signed.

A total of $1.45bn would be paid immediately, and another $1.65bn by the end of the year, he said.

Mr Novak insisted that Ukraine would still have to pay in advance for new deliveries.

Mr Oettinger, who steps down as European energy commissioner on Friday, said: "We can say to the citizens of Europe that we can guarantee security of supply over the winter."

Meanwhile, the French and German presidents said that they spoke with Russian President Vladimir Putin and his Ukrainian counterpart Petro Poroshenko on Thursday evening.

All four "have welcomed the conclusion of negotiations" the European heads said in a joint statement.