CSX Corp. announced yesterday it had agreed to sell its Sea-Land international ocean shipping business to A.P. Moller-Maersk Lines of Copenhagen for $800 million, creating the world's largest container-shipping company.

The new company will operate under the name Maersk-SeaLand and will have its headquarters in Madison, N.J., Maersk's current headquarters in the United States.

CSX officials said that the company will maintain a "presence" at Sea-Land's headquarters in Charlotte.

Sea-Land President John P. Clancey will be chairman of the new corporation, and Maersk President Tommy Thomsen will serve as president and chief executive.

Richmond-based CSX will retain some of its container-shipping terminals, including a large terminal in Hong Kong, and will continue to operate its domestic ship fleet to Alaska, Hawaii, Puerto Rico and Guam.

In early May, Maersk and Sea-Land angered Baltimore officials when they chose New York as their new joint container terminal despite the city's offer to build a new terminal at Dundalk and to provide the companies with numerous other concessions.

In a joint announcement, the companies pledged to continue to operate their U.S.-flag vessels with U.S. crews and said they do not expect any loss of seagoing jobs. They also pledged to maintain all current U.S. government contracts, including military obligations.

The new company will have 250 vessels, including 48 U.S.-flag ships with four additional U.S.-flag vessels on order from U.S. shipyards, the statement said. CSX will continue to operate 16 U.S.-flag container vessels.

John W. Snow, chairman and chief executive of CSX, said that the transaction will allow CSX to pay off some of the debt it incurred when it purchased a part of northeastern railroad Conrail, but that the debt was not the primary purpose for the sale of its Sea-Land shipping business.

Snow said the transaction will allow the new company to cut costs and extend its reach under one management. The two companies have had a vessel-sharing agreement since 1991.

CSX also announced a drop in earnings, largely because of the expenses of the Conrail merger, but also brought on by weak coal shipments.

The corporation announced a profit of $114 million, or 53 cents a share, in the second quarter, compared with $151 million, or 70 cents per share, in the same period last year.

For the first six months of the year, the company reported a profit of $189 million, or 89 cents per share, excluding a $49 million first-quarter adjustment for new accounting guidelines, compared with $242 million, or $1.12 per share.

Snow said in a statement that expenses were higher than anticipated because of some "rough spots" in the integration of the two rail systems, which took place on June 1.

CSX, which has rail and maritime transportation holdings, has gradually begun to concentrate on its rail business. CSX Transportation is one of the "big four" U.S. railroads.