The Grace 1 was seized by British Royal Marine commandos off the coast of the territory at the western mouth of the Mediterranean on July 4.
An Iranian oil tanker is being reflagged and is preparing to sail to the Mediterranean, Iran's state television reported on Friday, after Gibraltar decided to free the seized ship.
"Based on the owner's request, the oil tanker Grace 1 will depart for the Mediterranean after being reflagged under the Iranian flag and renamed Adrian Darya after preparing for the journey," the television quoted Jalil Eslami, deputy head of Iran's Ports and Maritime Organisation, as saying.
Britain's Mediterranean territory Gibraltar decided on Thursday to free the Panama-flagged tanker, but did not immediately indicate when or if the ship would set sail after the United States launched a new, last-minute legal bid to hold it.
"The 25-member crew will start their journey after preparations, including refueling," Eslami said.
The television report did not identify the tanker's owner.
The Grace 1 was seized by British Royal Marine commandos off the coast of the territory at the western mouth of the Mediterranean on July 4 on suspicion of violating European Union sanctions by taking oil to Syria, a close ally of Iran.
Two weeks later, Iran seized a British-flagged tanker in the Strait of Hormuz leading into the Gulf.
The two tankers have become pawns in the standoff between Iran and the West, their fate tangled up in the diplomatic differences between the EU's big powers and the United States.
Gibraltar officials did not make clear whether the U.S. legal bid would mean the ship would have to be detained further or, if so, for how long.
Iran said the ship would sail shortly and Foreign Minister Mohammad Javad Zarif characterised the U.S. bid to prevent it from leaving as "piracy".