Russia and Ukraine are poised today to end the protracted gas row that has left half of Europe perilously short of energy supplies, following a breakthrough at talks yesterday between the leaderships in Moscow and Kiev.

Russia's prime minister, Vladimir Putin, and his Ukrainian counterpart, Yulia Tymoshenko, spent five hours in talks deep into Saturday night. Emerging at 2.30am yesterday, they announced that Ukraine would pay full European-style prices for its gas from next year, with a 20% discount for this year. The agreement could see supplies to a frozen Europe restored tomorrow.

Additionally, Russia will pay a reduced transit fee this year, before switching to a market rate from next year.

The agreement appears to end the venomous three-week dispute between Kiev and Moscow and pave the way for the swift resumption of gas supplies, via Ukraine, to an exasperated European Union.

Last night, however, the EU sounded a cautious note. "The [European] commission welcomes the announcement ... but we have seen many false dawns in this dispute and the test is whether or not the gas flows to Europe's consumers," it said. "Until that point, the wait goes on for Europe."

The US called the rapprochement a "positive development" and added that the Russian energy giant Gazprom should "restart the flow of gas immediately".

Tymoshenko is due to fly to Moscow again today to hold further negotiations with Putin this afternoon.

The clue to the deal could lie in dealings between the two prime ministers, who spent much of the weekend in talks with no other aides present. Tymoshenko launched her political career as an anti-Russia firebrand of the orange revolution, but has since seen the political value in cultivating more nuanced relations with Russia. Russia refused to deal with her nominal boss and adversary - the Ukrainian president, Viktor Yushchenko.

Yesterday Gazprom and its Ukrainian equivalent, Naftogaz, drew up documents formalising the outline agreement. But Ukrainian officials concede that several critical details had yet to be ironed out. They also said the earliest the Siberian gas could start flowing again to Europe would be tomorrow. "The devil is in the details. The details are still not settled," one Ukrainian official said.

He added: "There is an agreed philosophical position. Both sides understand the continuation of this war drastically damages their interests in Europe, as well as their finances. Both are directly interested in settling this as soon as possible." He went on: "These negotiations aren't mock ones. They are real."

Russia turned off the gas to Ukraine on 1 January after Kiev rejected Moscow's offer of $250 per 1,000 cubic metres of gas for 2009. It terminated all gas exports to Europe on 7 January, claiming that Ukraine was siphoning off gas for itself. The move affected 18 EU countries, with parts of Bulgaria, Moldova and Bosnia worst hit. Hundreds of thousands of households and businesses were left without heating.

Officials in Kiev now admit that there was no prospect of gas being delivered again to Europe before Ukraine's bilateral gas dispute with Russia was settled - despite an apparent agreement a week ago. They describe the row as a disaster for Ukraine's attempts to integrate with the EU. Russia's reputation as a reliable energy supplier has also been shredded.

Ukraine has now apparently yielded to Moscow's demand that it pay market prices for Russian gas. Both sides have also agreed to eliminate the shadowy intermediary firms that make the business of gas trade between the former Soviet republics so opaque. This has however been agreed before, only for it not to happen.

It remains unclear whether Yushchenko will respect yesterday's deal. Attempts to resolve the standoff have been complicated by Ukraine's dysfunctional political system. Russia has refused to negotiate with him since last August's war in Georgia, during which Ukraine's president unequivocally backed Georgia.