"She was released about 30 minutes ago after the bail of $333,000 was posted," Mohammad Shadabi, an official at the Tehran prosecutor's office, said on Tuesday.
However, Esfandiari's whereabouts were not immediately known.
Shaul Bakhash, Esfandiari's husband, said that her mother had received a call from an Iranian judiciary official informing her of the decision to release her daughter.
Bakhash said that Fanny Esfandiari had used the deed to her Tehran flat to post bail and that he expected Haleh to return to her mother's home.
"I feel extremely good. It has been a very anxious several months. Now we hope she will not only be released from prison but allowed to come back home," Bakhash said from his home in Potomac, Maryland.
Bakhash said he still did not know the terms of her bail.
It was not immediately clear if Esfandiari would have permission to leave Iran after her release.
"I can't say for now that she will be allowed to leave the country or not," Shabadi said. 'Interrogated'
Esfandiari is director of the Middle East programme at the US-based Woodrow Wilson international centre for scholars.
|"It has been a very anxious several months. Now we hope she will not only be released from prison but allowed to come back home"|
Shaul Bakhash, Esfandiari's husband
The centre said it had been informed that Esfandiari was being released on bail and that her cousin in Tehran planned to pick her up, but it did not have any official comment on the release.
The centre describes itself as a non-partisan organisation dedicated to the study of domestic and international affairs.
It said that three masked men holding knives threatened to kill Esfandiari on December 30 as she was her way to Tehran airport after visiting her 93-year-old mother.
They took her baggage, including her US and Iranian passports and, for several weeks, she was interrogated for up to eight hours a day. Most of the questioning focused on the activities of its Middle East programme, the centre said.
Iran confirmed in May that it had detained Esfandiari and charged her later that month. The only contact her family has had with her since has been short telephone calls to her mother. Video broadcast
Earlier this month, Iranian authorities said they had concluded investigations into the cases of Esfandiari and Kian Tajbakhsh, another Iranian-American accused of conspiring against the country's security.
At the time, no decision had been made on whether they would be put on trial.
Last month, Iranian public television broadcast a video in which Esfandiari said a network of foreign activists was trying to destabilise Iran and bring about "essential" social change.
The video also featured Tajbakhsh, an urban planning consultant with the Soros foundation's open society institute.
Both the Wilson centre and the New York-based institute have criticised the Iranian government for the broadcast and dismissed the statements as "coerced."
The Iranian intelligence ministry has accused Esfandiari of trying to set up networks of Iranians with the ultimate goal of creating a "soft revolution" in Iran, along the lines of the revolutions that ended communist rule in eastern Europe.