As Gibraltar Chronicle reports, the decision to release the ship was taken hours after the US reportedly launched a separate last-minute legal move to detain the vessel.
But Chief Justice Anthony Dudley said that there was no US application currently before the court.
"That's not before me," he said.
"There are no applications in relation to the US letters of request [for mutual legal assistance]."
"The detention is over immediately," according to the judge, but it was not immediately clear why that decision had been taken.
Iran reportedly gave authorities in Gibralta an undertaking on the tanker's destination.
"From the minute that the judge made his order, the ship is no longer any compulsion to stay within the jurisdiction," lawyer Charles Gomez says outside the Supreme Court of Gibraltar of the supertanker at the center of a standoff with Tehran.