CAIRO—The container ship that blocked the Suez Canal for days earlier this year set sail Wednesday after its owners reached a multimillion-dollar compensation deal with Egyptian authorities for its release, ending a monthslong saga involving passage through a critical global trade route.

The Suez Canal Authority and representatives of the Ever Given’s owners signed the deal at its headquarters in Ismailia early Wednesday.

The SCA didn’t provide details of the agreement that allowed the ship to leave the canal. Its chairman, Osama Rabie, said that the negotiations concluded in “a fair deal” for both sides. He added that the authority has already been paid a large part of the compensation amount with the rest to be paid later this month.

In a nod to how the ship’s grounding and eventual seizure by Egyptian authorities caught the world’s attention, the SCA held a ceremony to mark the ship’s departure from the port in Ismailia that was attended by foreign diplomats and broadcast live on Egyptian TV.

The ship blocked the Suez Canal for nearly a week in March before being dislodged from its banks. The SCA had demanded payment for the costs of the rescue operation, damages to the canal’s banks and lost revenues. An Egyptian court, which had ordered the seizure of the ship after authorities initially claimed about $900 million in compensation, allowed its release on Tuesday.

A man holds an Egyptian flag as the Ever Given is seen on the Suez Canal.

A man holds an Egyptian flag as the Ever Given is seen on the Suez Canal.

Photo: amr abdallah dalsh/Reuters

A preliminary deal was struck late last month between the owner and insurers of the Ever Given and the SCA called for about $200 million in compensation, according to people familiar with the deal. But Egyptian media has said the amount is much higher and the deal also includes a tug boat, which Mr. Rabie said Wednesday was a gift from the shipowner for the SCA’s efforts during the crisis. The shipowner, Shoei Kisen Kaisha Ltd. of Japan, the ship’s charterer, Taiwan’s Evergreen Marine Corp. , and its technical manager, Bernhard Schulte Shipmanagement, declined to comment on the deal’s terms at the time.

The 1300-foot Ever Given ran aground in the Suez Canal on March 23. It blocked the width of the waterway, causing a global shipping traffic jam with vessels anchored on both sides of the waterway as they waited for it to be cleared. Other ships rerouted around the canal. Egyptian engineers and sailors, together with an elite Dutch salvage team, worked around the clock over six days to free the ship, dislodging it on March 29.

The blockage drew focus on the high economic stakes of such accidents. It disrupted the world’s supply lines and upset the usually carefully orchestrated management of the world’s containers in which shippers pack goods for transport by sea. The canal connects the Mediterranean and Red Seas and accounts for as much as 13% of seaborne trade and about 10% of the maritime shipments of oil.

The 1300-foot Ever Given ran aground in the Suez Canal on March 23.

The 1300-foot Ever Given ran aground in the Suez Canal on March 23.

Photo: ©Maxar Technologies/Associated Press

Yukito Higaki, president of Japan’s Imabari Shipbuilding Co.—whose group includes the ship’s owner, Shoei Kisen—in a recorded message to the SCA said his company’s ships would continue to use the Suez Canal, calling it an indispensable asset for international maritime trade.

The Ever Given, laden with some 18,000 containers, is carrying goods worth billions of dollars that are now months late.

The shipowner said the Ever Given was sailing to the nearby Port Said for a dive survey of the vessel. If approved, the ship would then complete her voyage to the next port where her cargo would be discharged, it said.

SHARE YOUR THOUGHTS

What lingering outcomes do you see coming from the Ever Given episode? Join the conversation below.

The question of who is to blame for the accident was at the heart of the dispute over how much compensation the ship’s owners should pay. Its resolution is likely being closely watched by owners and operators of thousands of ships that pass through the canal every year. It isn’t clear if the SCA would release the findings from its investigation on Wednesday.

In May, Egyptian officials had accused the ship’s captain of losing control and hitting the canal’s bank. A lawyer for the ship’s owner blamed the SCA for allowing the ship to enter the canal during a massive sandstorm that was taking place in Egypt at the time. Initial investigations into the accident had focused on a sudden gust of wind.

The blockage was the latest in a series of transportation crises to confront Egypt. The 2016 crash of an EgyptAir flight from Paris shook international confidence in the government of President Abdel Fattah Al Sisi after French officials accused Egyptian investigators of obstructing the probe.

Mr. Sisi, a former general who seized power in a military coup in 2013 and ordered an $8.5 billion expansion of the canal the following year, had demanded action in clearing the waterway as he faced one of the biggest tests to confront his government.