MOSCOW, Russia (CNN) -- The prime ministers of Russia and Ukraine reached an agreement early Sunday morning to resume gas supplies to Europe by early next week.
Russian Prime Minister Vladimir Putin meets Ukrainian Prime Minister Yulia Tymoshchenko in Moscow Saturday.
The two leaders have asked the gas providers of their respective countries to prepare by Monday all pertinent documents that need to be signed, said Ukrainian Prime Minister Yulia Tymoshenko on Russian state television.
"As soon as these documents are signed on gas transit and gas purchase, all gas transport to Europe will be resumed," she said.
Tymoshenko and her Russian counterpart, Vladimir Putin, met in Moscow for five hours -- in negotiations that she described as "difficult" but successful.
The two premiers agreed that Russia will give Ukraine a 20 percent discount on the gas purchase. In exchange, Ukraine will not hike the fees it charged Russia to transport gas onward to European countries.
The two sides will move to a European pricing formula next year, said Putin, who appeared with Tymoshenko during the broadcast.
Ukraine is a major entry point for Russian gas into Europe.
The problems began at the end of last year when Ukraine and Russia failed to resolve a dispute over Ukraine's past payments for Russian gas, and failed to agree on the terms for a new contract. Watch how a simple price dispute led to the crisis »
As a result, Russia turned off Ukraine's gas while at the same time promising the supply to Europe would be unaffected.
Despite the guarantee, the European supply was brought to a halt January 7, something each side blamed on the other. Watch how Slovakia has been affected by the gas row »
The gas shutoff has millions in Europe suffering from shortages in heat and cooking gas during an unseasonably cold winter. Eastern Europe, in particular, is experiencing historic lows in temperatures this year.
The European Union has called the problem a bilateral one that Russia and Ukraine needed to resolve. The bloc has repeatedly said the longer the dispute drags out, the more damage it does to both nations' credibility and reliability as energy suppliers.
CNN's Maxim Tkachenko and Michael Sefanov contributed to this report.