The Maltese-flagged Med Emre, owned by Turkish company YMN Tankers, was towed to an anchorage off the port on Friday morning, with only its keel visible above the water, the ministry said.
A remotely operated underwater robot was being positioned to begin inspecting the vessel, the ministry added.
The vessel capsized last week in an ecologically sensitive area of the Mediterranean, killing its chief engineer. The cause of the accident remains unknown.
The Spanish government has repeatedly said that no pollution has been detected so far.
The Med Emre was towed 165 nautical miles from the accident site to the port of Cartagena in southeastern Spain by a vessel operated by Spain’s maritime rescue service, the ministry said.
Don’t miss our journalists’ daily news roundup from Spain
Around 150 technicians and 15 support vessels have been deployed at the port to ensure the vessel is safely brought into port, an operation expected to be completed by the end of Friday.
The removal of the diesel is due to begin afterwards and should be completed before Christmas, according to the authorities.
In 2002, Spain suffered its worst environmental disaster when the Prestige oil tanker split in two and spilt more than 60,000 tonnes of fuel, damaging thousands of kilometres of Atlantic coastline.