KYIV, Ukraine—Russia launched a missile attack on Ukraine’s key grain-exporting port of Odessa, officials said, hours after signing an international agreement to ease its blockade of the Black Sea coastline and allow for the safe transport of grain and other foodstuffs necessary to alleviate a looming global food crisis.

The attack on Odessa appeared to violate the terms of the United Nations-brokered agreement signed by Russia and Ukraine in Istanbul on Friday, which stipulated that both countries would refrain from attacking port facilities or civilian ships used for grain transport, according to a copy of the agreement reviewed by The Wall Street Journal. U.N. Secretary-General António Guterres condemned the strike, saying in a statement that all parties had committed to ensuring the safe movement of Ukrainian grain shipments.

At least two Russian Kalibr cruise missiles hit Odessa, the only major Ukrainian port resisting Russian occupation, damaging infrastructure at the site, Ukraine officials said. Another two of the missiles, which Russia has been launching from warships and submarines, were shot down by aerial defenses, officials said.

A railcar discharging point and a warehouse used for loading grain were destroyed in the attack, according to international grain traders.

The target of the strike was likely a nearby shipbuilding yard, workers at the port said.

“It’s obvious that the agreement with Russia is not even worth the paper it was signed on…Russia is a terrorist state,” said Ukraine’s ambassador to Turkey, Vasyl Bodnar, who was present at the signing of the agreement.

Ukrainian Foreign Ministry spokesman Oleg Nikolenko said the attack on Odessa was like spitting in the face of the U.N. and Turkey, which facilitated and hosted the negotiations.

“We urge the U.N. and Turkey to ensure Russia’s compliance with its obligations to provide a safe corridor for the grain exports,” Mr. Nikolenko said in a statement posted to Facebook.

A resident of Kharkiv, northeastern Ukraine, on Saturday carried items out of an apartment damaged by a Russian attack.

Photo: STRINGER/REUTERS

Russia’s Defense Ministry didn’t respond to a request for comment, nor was there any comment from the Kremlin.

Turkish officials who helped broker the agreement said they had been in contact with Russia, which denied being behind the attack.

“The Russians told us that they had absolutely nothing to do with this attack and that they were examining the issue very closely and in detail. The fact that such an incident occurred right after the agreement we made yesterday regarding the grain shipment really worried us as well,” said Turkey’s Defense Minister Hulusi Akar in a statement on Saturday.

Mr. Akar signed the agreements with Ukraine and Russia on behalf of Turkey on Friday. He added that Ankara would continue to fulfill its duties under the grain agreement, which calls on Turkey to help monitor the accord and inspect shipments.

Russia also struck a military airport and a railway station on Saturday in central Ukraine, authorities said, in another long-range attack reaching far beyond the immediate front lines. Ukraine, meanwhile, is continuing to take advantage of Western weapons to stall Russia’s military advance.

Andriy Raikovych, head of the Kirovohrad region in central Ukraine, said 13 missiles were fired at infrastructure and military facilities overnight, leaving at least three people dead and 13 wounded. Another strike, on Mykolaiv in the south, destroyed a warehouse, authorities there said.

Odessa, the only key port city on the Black Sea still held by Ukraine, was also shelled Saturday, with local media reporting seven missile strikes inside the urban area.

Ukraine’s forces meanwhile used U.S.-made Himar rocket launchers in a systematic shelling campaign seemingly aimed at cutting off vital supplies from the strategically important southern region of Kherson, which Russia has occupied since early in the invasion, Russian and Ukrainian officials said.

Kyiv’s use of Himars launchers to bombard two strategic bridges over the Dnipro and Inhulets rivers has already made tank and truck traffic between Kherson and Russia near-impossible, according to officials and footage from the ground circulating on social media. Ukrainian officials have said that they are preparing a counteroffensive to liberate the Kherson region.

Residents of cities throughout Ukraine have largely become accustomed to the sound of air-raid sirens portending a possible rocket attack, with the majority disregarding advice to find the nearest underground shelter and wait until the danger has passed. Mr. Raikovych asked them to reconsider.

“I continually urge you to not ignore the sirens and immediately go to a shelter,” he wrote on the Telegram messaging app.

The latest round of attacks beyond the front lines comes as Ukrainian forces slow the Russian campaign to take the Donbas region in the east. Ukraine’s strikes on arms depots and strategic bridges in Russian-occupied territory, and its effective use of Himars rocket systems and other Western-supplied arms, have made it much harder for Russia to solidify its occupation in certain regions and to maintain the relentless artillery barrages that have underpinned its piecemeal but steady advance since April.

Analysts say a brief operational pause earlier this month following Russia’s capture of the eastern Luhansk region has given its troops too little time to recover before their campaign resumed this week.

Part of a rocket protrudes from a wheat field in the Kharkiv region.

Photo: sergey bobok/Agence France-Presse/Getty Images

“Russian forces are degraded, they are beat up, tired and exhausted, and they need to regroup in order to be able to regain some of the combat effectiveness which they’d lost over the course of the Donbas campaign and the overall war,” said George Barros, an analyst at the Washington-based Institute for the Study of War. “An approximately 10-day operational pause is not sufficiently long for the Russian forces to be able to regain the strength that they need.”

While the battlefield picture has ossified in recent days, diplomatic avenues to resolve the crisis have made some headway. In the agreement aimed at ending the grain crisis caused by the war, Ukraine and Russia paved the way for the resumption of exports from Black Sea ports blocked by Russian ships. Delegates from the two countries signed parallel deals Friday at a ceremony in Istanbul, following months of diplomacy led by Turkey and the United Nations.

The agreement could free up about 18 million tons of wheat, corn and other supplies that have been stuck at Ukrainian ports and grain silos for weeks. Grain analysts have said they expect it could take weeks for grain shipments to begin flowing again, if both sides remain committed to the deal.

Late on Friday, Ukraine said operations at some of its ports may resume in as little as three days. Yury Vaskov, Ukraine’s deputy infrastructure minister and a member of the country’s delegation at the talks in Istanbul, told Ukrainian media on Friday that the port of Chornomorsk south of Odessa is preparing to handle the first vessel carrying grain.

River traffic on Thursday near the port of Reni, on the Ukrainian stretch of the Danube.

Photo: Sergii Kharchenko/Zuma Press

The most active wheat futures contract fell 5.9%, to $7.59 per bushel, in trading on the Chicago Board of Trade Friday, as the deal raised hopes that a restart to Ukrainian grain exports would ease a brewing global food-supply crisis.

The deal has been seen as a limited but promising step toward bringing the two sides closer to a peace deal. Some European Union countries have suggested Ukraine should make concessions to Russia in exchange for peace. But in an interview with The Wall Street Journal on Friday, Ukrainian President Volodymyr Zelensky said any pause in the fighting could merely give battered Russian forces a chance to regroup and rearm.

Instead he called for further weapons supplies from the West, and credited the support of Ukraine’s allies for shifting the balance on the battlefield and allowing Ukraine to bog down Russian troops fighting to capture swaths of the country’s east. Shortly after he spoke, the White House on Friday announced another $270 million worth of weapons for Ukraine, including four more Himars and hundreds more Phoenix Ghost drones.

The U.S. also said that the Pentagon is considering providing Ukrainian forces with jet fighters. It is “making some preliminary explorations into the feasibility of potentially providing fighter aircraft to the Ukrainians,” said John Kirby, the National Security Council coordinator for strategic communication. U.S. officials have previously resisted supplying Ukraine with jet fighters over concerns that they could risk a more direct conflict with Moscow.

Write to Matthew Luxmoore at Matthew.Luxmoore@wsj.com, Bojan Pancevski at bojan.pancevski@wsj.com and Jared Malsin at jared.malsin@wsj.com