The Canadian government on Tuesday invoked a 1977 treaty in a U.S. court to save Enbridge Inc.’s disputed Line 5 oil pipeline from a demand by Michigan’s top officials to shut down service on Wednesday.

The 540,000 b/d system is scheduled to be shut down at the Straits of Mackinac crossing between Lake Michigan and Lake Huron under an order by Gov. Gretchen Whitmer. Whitmer and Michigan Attorney General Dana Nessel have lost state court battles for orders to stop Line 5 flows and cancel an agreement to bury the Straits pipe leg in a new $500 million utility tunnel.

“The United States undertook a solemn and reciprocal commitment to Canada…not to interfere with the operations of international hydrocarbon transit pipelines,” said the Canadian brief filed in the U.S....