The family of American Matthew Trevithick said their son had been released on Saturday from Evin Prison in Tehran.
"We are profoundly grateful to all those who worked for his release and are happy for all the families whose loved ones are also heading home," the family said in a statement.
The statement said that Trevithick was released after 40 days in prison. It added that he went to Iran in September to study Dari in a center affiliated with Tehran University.
A U.S. official said on Saturday Iran had released the student separately from four other Americans who were released in a prisoner swap as international sanctions were due to be lifted on Iran.