The United States and Iran cut off formal diplomatic ties in 1980, shortly after students and Islamic militants stormed the U.S. Embassy in Tehran and took American diplomats hostage.
But officials from both countries have said they are open to direct talks in order to find a diplomatic solution to a decade-long dispute over Iran's nuclear programme, over which the West has imposed economic sanctions on the Islamic Republic.
Tehran denies seeking nuclear weapons but the United States and its allies suspect it is working towards a nuclear weapons capability.
Iranian Foreign Ministry spokeswoman Marzieh Afkham said on Tuesday that Obama had sent Rohani a message of congratulations on the occasion of his election.
"As we have seen in news reports, this letter has been exchanged," Afkham said, according to the ISNA news agency. "The mechanism for exchanging these letters is through current diplomatic channels."
Obama said in an interview broadcast on Sunday he had exchanged letters with Rohani. The two men will speak on the same day at the U.N. General Assembly next week, though there are currently no plans for them to meet.
Rohani, a centrist cleric who defeated more conservative candidates in June elections, has said he wants to pursue "constructive interaction" with the world, raising expectations of a negotiated settlement to the nuclear dispute.