The Ukraine Black Sea grain deal has been extended for two more months one day before Russia could have quit the pact over obstacles to its grain and fertiliser exports.
Turkish President Tayyip Erdogan announced the extension in a televised speech and it was confirmed by Russia and Ukraine.
The flow of ships through the corridor had been grinding to a halt during the last few days with the deal apparently set to expire tomorrow.
"The Black Sea grain corridor deal has been extended by two months with the efforts of Turkey," said President Erdogan, who also thanked the Russian and Ukrainian leaders and UN Secretary General Antonio Guterres for their help.
The United Nations and Turkey brokered the Black Sea deal for an initial 120 days in July last year to help tackle a global food crisis that has been aggravated by Moscow's invasion of Ukraine, one of the world's leading grain exporters.

Moscow had initially appeared unwilling to extend the pact unless a list of demands regarding its own agricultural exports was met.
"This is a chance to help ensure global food security, not in words, but in deeds. First and foremost, to help the countries most in need," Russia's foreign ministry said, confirming the extension.
"Our principled assessment of the Istanbul agreements of July 22, 2022, has not changed and the distortions in their implementation should be corrected as soon as possible."

While Russian exports of food and fertiliser are not subject to Western sanctions imposed following the February 2022 invasion of Ukraine, Moscow says restrictions on payments, logistics and insurance have amounted to a barrier to shipments.
Russia's envoy to the UN said the deal was extended because "we still do not lose hope" that problems with Russia's exports will be "sorted out".
The United States has rejected Russia's complaints. US Ambassador to the UN Linda Thomas-Greenfield said last week: "It is exporting grain and fertiliser at the same levels, if not higher, than before the full scale invasion."
Extension welcomed by Ukraine
Ukraine welcomed the extension but a senior official said Russia must not be allowed to sabotage the agreement and must stop using food "as a weapon and blackmail".
"We welcome the continuation of the Initiative, but emphasise that it must work effectively," Deputy Prime Minister Oleksandr Kubrakov said on Facebook.
Earlier today, the last remaining ship registered to travel through the corridor had left a Ukrainian port.
UN data showed that the DSM Capella had left the Ukrainian port of Chornomorsk carrying 30,000 tonnes of corn and was on its way to Turkey.
Officials from Russia, Ukraine, Turkey and the UN make up a Joint Coordination Centre (JCC) in Istanbul, which implements the Black Sea export deal.
They authorise and inspect ships. No new vessels have been authorised by the JCC since 4 May.
Authorised ships are inspected by JCC officials near Turkey before travelling to a Ukrainian Black Sea port via a maritime humanitarian corridor to collect their cargo and return to Turkish waters for a final inspection.
In an excerpt of a letter seen by Reuters last month, Russia told its JCC counterparts that it would not approve any new vessels to take part in the Black Sea deal unless the transits would be done by 18 May - "the expected date of ... closure."
It said this was "to avoid commercial losses and prevent possible safety risks" after tomorrow.
Some 30.3 million tonnes of grain and foodstuffs has been exported from Ukraine under the Black Sea deal, including 625,000 tonnes in World Food Programme vessels for aid operations in Afghanistan, Ethiopia, Kenya, Somalia and Yemen.
Military aid fund
European Union foreign policy chief Josep Borrell has proposed adding €3.5 billion to a fund used to finance military aid for Ukraine, according to EU sources.
The sources, speaking on condition of anonymity, said Mr Borrell had asked EU governments to raise the financial ceiling on the European Peace Facility (EPF), a fund that has already allocated some €4.6 billion in military aid for Ukraine.
"He's just made the proposal," a European diplomat said.

Mr Borrell's proposal requires approval from the EU's national governments. They agreed last December that, "in case of need", such an increase could be justified.
The fund, established in 2021, was conceived for the EU to help developing countries buy military equipment. But the 27-member union quickly decided to use it also to get weapons to Ukraine after Russia's invasion in February last year.
The fund is separate from the EU's budget, which is not allowed to finance military operations.
But the fact that EU countries clubbed together to buy weapons and ammunition for a country at war with Russia marked a historic step for the bloc, which for decades avoided involvement in defence and military matters.
The war has meant that the EPF has burned through cash far more quickly than planned. It originally had a budget of €5 billion, meant to last until 2027. That ceiling has already been raised once, by €2 billion last December.
The fund allows EU countries that supply weapons and ammunition to Ukraine to claim back a portion of the cost. EU countries contribute to the fund according to the size of their economies.
A senior EU official said Mr Borrell had decided to ask for a boost as the fund was running low and the EU's foreign policy service wanted to be sure the EPF had enough cash to finance military aid for other countries as well as Ukraine.
"We have to top up," said the official. "The gist of the European Peace Facility ... has a universal character. It was not conceived by Ukraine. It was conceived for any conflict that the European Union could deal with."