Ukraine, which stands to lose millions in transit payments, issued a statement saying Hungary's supply deal was a "purely political, economically unreasonable decision" and was to the detriment of Ukrainian-Hungarian relations.

In turn, Hungarian Foreign Minister Peter Szijjarto told a news conference Ukraine was meddling.

"(European) gas consumption will not decline, and Gazprom's role will not decline either," Szijjarto said after Gazprom and Hungarian energy group MVM executives signed the deal.

"For Hungary, energy safety is a matter of security, sovereignty and economy rather than a political matter," he said. "You cannot heat homes with political statements."

Russia, which used to ship natural gas primarily through Ukraine, has diversified export routes, constructing the undersea Nord Stream pipelines direct to Germany and the TurkStream link from Russia to Turkey.

Under the deal finalised with Hungary at the end of August, effective from Oct. 1 and signed on Monday, Gazprom will ship 4.5 billion cubic metres of gas to Hungary annually, via two routes: 3.5 billion cubic meters via Serbia and 1 billion cubic meters via Austria.

Apart from saying the deal was political, the statement from Ukraine's foreign ministry said it would have a significant impact on the energy security of Ukraine and Europe and it would ask the European Commission to assess whether the deal respected European energy law.

"Hungary will start receiving Gazprom's gas starting from Oct. 1 already via TurkStream and the pipelines of South-Eastern Europe," Gazprom's head Alexei Miller said in a statement.

TurkStream via the Black Sea as well as the Nord Stream pipelines on the bed of the Baltic Sea are part of Russia's plans to bypass its political foe Ukraine when selling its gas to Europe.

The European Commission had no immediate comment.

A surge in benchmark gas prices as demand rebounds following pandemic lockdowns is a politically charged issue.

Some European politicians have called for an investigation into Gazprom and accused it of holding back extra supplies.

When Hungary agreed the terms of the new supply deal at the end of August, Szijjarto said the price had been agreed but did not give details. On Monday he said retail consumers would continue to pay one of the lowest gas prices in Europe.

The deal will supply around half of Hungary's annual gas consumption of between 9 and 10 billion cubic meters.

Hungary has reduced its reliance on Russian gas in recent years, opening cross-border interconnectors with most of its neighbours.

(Reporting by Krisztina Than; Additional reporting by Natalia Zinets in Kyev, Vladimir Soldatkin in Moscow and Kate Abnett in Brussels; Editing by Kim Coghill, Barbara Lewis and Kirsten Donovan)

By Anita Komuves and Krisztina Than