Russia and Ukraine have reached an agreement "in principle" on the transit of Russian gas to Europe, officials said on Thursday, ahead of a looming New Year deadline.

Some 18 percent of the EU's annual natural gas consumption comes from Russia via Ukraine, putting additional pressure on EU officials to broker a deal.

"We reached an agreement in principle," said Maros Sefcovic, the European Commission vice president in charge of energy, after a full day of talks in Germany with the Russian and Ukrainian energy ministers.

Sefcovic gave no details on the content of the draft deal and said it would still have to go back to Moscow and Kiev to be finalised before it could be signed.

Russian Energy Minister Alexander Novak, speaking alongside his Ukrainian counterpart Oleksiy Orzhel, said he hoped the deal could be signed "very soon".

Orzhel said the two sides had come up with a text that "brings us closer to a solution".

The current gas transit contract between the two ex-Soviet countries expires at the end of the year and ties between the two countries have been shredded since Moscow annexed Crimea in 2014 and supported a separatist insurgency in eastern Ukraine.

About 18 percent of the EU's annual natural gas use comes from Russia via Ukraine, putting additional pressure on EU officials to broker a deal; in image EU Commission VP Maros Sefcovic, Russia's Minister of Energy Alexander Novak and Ukrainian Minister o
About 18 percent of the EU's annual natural gas use comes from Russia via Ukraine, putting additional pressure on EU officials to broker a deal; in image EU Commission VP Maros Sefcovic, Russia's Minister of Energy Alexander Novak and Ukrainian Minister of Energy Oleksiy Orzhel AFP / John MACDOUGALL

Last year Russian gas giant Gazprom supplied Europe with 200.8 billion cubic metres of natural gas, with about 40 percent going through Ukraine, earning the country around $3 billion a year in transit fees.

Russian President Vladimir Putin said Thursday that Moscow wants to keep some gas flowing through Ukraine, despite having built several pipelines to Europe since the current deal was agreed a decade ago.

Russia's gas pipelines include the Nord Stream 2 project which seeks to double gas volumes to Germany.

Putin said he was optimistic about a deal.

"I think we will agree. We are on our way to an agreement. We will strive for Ukraine to be content with this agreement," he said during his annual end-of-year news conference.

Transit problems for Russian gas began after the fall of the Soviet Union when an independent Ukraine won control of the pipeline infrastructure.

Several supply crises followed, with Russia using gas as a weapon against Ukraine and cutting supplies repeatedly in 1992, 1993 and 1994.

The current contract between Russia and Ukraine was signed following the last gas crisis which ended up disrupting European supplies in 2010.