The two sides inked separate but identical agreements in the presence of UN Secretary General Antonio Guterres and Turkish President Recep Tayyip Erdogan in Istanbul.
Ukrainian President Volodymyr Zelensky later said around 20 million tons of produce from last year’s harvest and the current crop would be exported under the agreement.
Russian Defence Minister Sergei Shoigu told Kremlin state media after attending the signing ceremony that he expected the deal to start working in the next few days.
The deal is initially set to last for 120 days but it can be renewed if both parties agree.
Huge quantities of wheat and other grain have been blocked in Ukrainian ports due to the ongoing war.