Crude Oil ( ) Brent Crude ( ) Natural Gas ( ) S&P 500 ( ) PHLX Oil ( )

THE NEW YORK TIMES – Russian and Ukrainian officials reached an agreement on Thursday night to resume Russian deliveries of natural gas to prevent shortages over the winter.

The deal caps months of laborious talks under the aegis of European Union authorities on how much, and how soon, Ukraine needed to pay Russia for gas it has already consumed, and on the terms for future deliveries.

The standoff between Moscow and Kiev also prompted concerns in Europe that Russian gas piped across Ukraine, a former Soviet state, could be interrupted.

There is “no reason for people in Europe to stay cold this winter,” José Manuel Barroso, the president of the European Commission, said at a news conference. Ukraine and Russia should “act as reliable partners,” he said.

The shuttle diplomacy reached its climax on Thursday night when Alexander Novak, the Russian energy minister, flew to Brussels for a signing with Yuri Prodan, his Ukrainian counterpart.

A week ago, the two men were at loggerheads when Mr. Novak demanded that the European Union help Ukraine pay $1.6 billion to help cover its debts, and after Mr. Prodan demanded that Russia sign a binding agreement to sell gas until next spring at $385 per 1,000 cubic meters.

On Thursday night, the ministers signed a deal guaranteeing Russian gas deliveries to Ukraine until March 2015 against a backdrop of the Russian and Ukrainian flags. A second signing took place between the chief executive of Gazprom, Alexei Miller, and his counterpart at Ukraine’s Naftogaz, Andriy Kobolev.

Mr. Novak, the Russian minister, told the same news conference he was satisfied that Ukraine “does have the funds” to pay for gas during November and December. He said the Ukrainians would pay $3.1 billion in two tranches by the end of the year to cover debts.

E.U. officials said those tranches would be based on a preliminary price of $268.50 per 1,000 cubic meters of gas.

Mr. Prodan, the Ukrainian minister, told the news conference the deal allowed his country to purchase additional Russian gas at a cost of $378 per 1,000 cubic meters until the end of the year, and at a cost of $365 per 1,000 cubic meters from January to March next year.

But Mr. Prodan said any final resolution of the gas feud would need to be settled at international arbitration.

Günther H. Oettinger, the European Union energy commissioner who has already brokered several rounds of talks, said the European Union and the International Monetary Fund would continue to assist Ukraine financially with its budget, its gas debts, and future gas payments.

E.U. officials said they expected Ukraine to pay about $1.5 billion for deliveries of around 4 billion cubic meters of Russian gas by the end of this year.

Keeping gas flowing to homes and businesses could be critical to keeping in power in Kiev the kind of pro-Western administration favored by the United States and the European Union, which have staked enormous political and financial capital on Ukraine’s future.

The signings were “perhaps the first glimmer of a relaxation in the relationship between the two neighboring countries,” Mr. Oettinger told the news conference. But Moscow and Kiev may struggle to enforce the deal.

The main concern for the European Union was its reliance on the shipment of gas through Ukraine for about one-fifth of its supplies. Gazprom, Russia’s natural gas giant, shut the taps in 2006 and 2009 because of disputes with Ukraine, leaving many homes in Central and Eastern Europe without heat and forcing rationing for industrial customers.

The deal was “something of a coup for E.U. negotiators given the real reluctance on the side of both Ukraine and Russia,” Timothy Ash of Standard Bank in London wrote in a note to clients on Thursday. While “neither side wanted to put pen on paper, neither wanted to be blamed for being the party responsible for vetoing any deal and then being named and shamed,” he wrote.

Mr. Ash speculated that German pressure on the government in Kiev may have pushed Ukraine to conclude a deal while the government in Moscow may have been wary the European Union could tighten sanctions and stymie the business interests of Gazprom.

The current round of talks began in early May after Gazprom sharply raised the price of gas to Ukraine in March. The price rose after Russia annexed Crimea and imposed an export tariff. In response, Ukraine ceased all payments.

By June, Russia had cut supplies again, demanding that Kiev settle its outstanding bills and pay upfront for future deliveries.