Russian Energy Minister Alexander Novak shakes hands with Ukraine's Energy Minister Yuri Prodan, right, after gas talks between the European Union, Russia and Ukraine at the European Commission headquarters in Brussels October 30, 2014. (Francois Lenoir/Reuters)

Russia agreed Thursday to resume selling natural gas to Ukraine, ending a cutoff that had threatened to leave Ukrainian households shivering as winter approached.

The stopgap deal will secure critical energy supplies for Ukraine through March and will also help assure European countries that their own natural gas supply will not be disrupted during chilly winter months. Russia cut off gas to Ukraine in June, following a price dispute and months of geopolitical turmoil.

The agreement appears to set up a truce, at least temporarily, on one front in the wide-ranging conflict between Russia and Ukraine, where pro-Russian rebels have seized territory in Ukraine’s industrial heartland. With freezing weather fast approaching, Western policymakers had worried about Ukraine’s readiness to make it through the winter without a fuel that is a critical source of heat. Europe, too, depends on natural gas that flows through Ukraine from Russia, making it vulnerable to any disruption.

“There is now no reason for people in Europe to stay cold this winter,” E.U. Commission President José Manuel Barroso told reporters in Brussels on ­Thursday.

The deal comes after months of fitful negotiations and questions about how Ukraine
would be able to pay down
a disputed multibillion-dollar
debt to Gazprom, the Russian ­state-controlled natural gas company. The relationship between Russia and the West is at its worst since the Cold War, and some leaders had worried that this winter would be a repetition of 2006 and 2009, when some Eastern and Central European households were left without heat after Russia throttled gas during disputes with Ukraine.

People stand in line to receive humanitarian aid on October 30, 2014 at the Donetsk Circus building in the eastern Ukrainina city of Donetsk. (Dimitar Dilkoff/AFP/Getty Images)

Ukraine depends on Russia for about 60 percent of its gas. About 15 percent of Europe’s natural gas flows through Ukraine from Russia, although some Eastern European countries are entirely dependent on that supply.

Ukraine agreed to pay $3.1 billion toward its debt to Russia in two installments by the end of the year. It plans to buy up to 4 billion cubic meters of gas at the price of $378 per thousand cubic meters until the end of the year, a discount of $100 from its current contract with Russia. Ukrainian Energy Minister Yuriy Prodan said Thursday that between January and March the price would be $365. That figure was not immediately confirmed by his ­Russian counterpart.

“The decisions we have taken today will provide for the energy security of Ukraine but will also facilitate the secure supply of gas to the European Union,” Prodan said.

E.U. officials said Thursday that some of the money to pay for the gas would come from E.U. and International Monetary Fund aid programs.

The prices are roughly the European average. For months Ukraine had sought a lower price, around $326, and it had also sought to eliminate the system of temporary discounts, a longtime Russian strategy that Ukraine says leaves it vulnerable to political pressure. That aspect of Thursday’s deal represented a clear capitulation for Ukraine.

The tension was palpable on Thursday when Prodan and ­Russian Energy Minister Alexander Novak each shook hands with their European mediator but hesitated for several awkward seconds before deciding to shake each other’s.

“The process has not been easy. However, we have managed to come to a compromise,” Novak said.

The deal does not guarantee that there will not be gas cutoffs this winter. Russia has blamed previous cutoffs — each for a stretch of several days — on technical difficulties, although they have coincided with times of ­political tensions.

The unresolved gas issue had appeared to be weighing on Ukraine’s leaders. Prime Minister Arseniy Yatsenyuk warned Ukrainians last month that they should expect a cold winter. An autumn break at some Ukrainian schools was recently prolonged to conserve energy.

Ukraine has pledged to reform its system of gas subsidies, which international critics say fuel corruption and discourage domestic energy production. But any such move will be politically unpopular for the parliament that Ukrainians elected on Sunday, the most pro-European in the nation’s ­history.

On the ground in eastern Ukraine, fighting continued Thursday, with both sides increasingly declaring an end to a Sept. 5 cease-fire. A Ukrainian military spokesman said Thursday that seven soldiers had been killed in the previous day. Rebel leader Alexander Zakharchenko — who is running in Nov. 2 rebel-sponsored elections that Ukraine and the European Union have condemned as a violation of the peace agreement — said Thursday that rebels would seek to conquer the key coastal city of Mariupol if Ukraine did not hand it to them peacefully.