WASHINGTON — The long-fractured relationship between the United States and Iran took a significant turn on Friday when President Obama and President Hassan Rouhani became the first leaders of their countries to speak since the Tehran hostage crisis more than three decades ago.

In a hurriedly arranged telephone call, Mr. Obama reached Mr. Rouhani as the Iranian leader was headed to the airport to leave New York after a whirlwind news media and diplomatic blitz. The two agreed to accelerate talks aimed at defusing the dispute over Iran’s nuclear program and afterward expressed optimism at the prospect of a rapprochement that would transform the Middle East.

“Resolving this issue, obviously, could also serve as a major step forward in a new relationship between the United States and the Islamic Republic of Iran, one based on mutual interests and mutual respect,” Mr. Obama, referring to Tehran’s nuclear program, told reporters at the White House after the 15-minute phone call. “It would also help facilitate a better relationship between Iran and the international community, as well as others in the region.”

A Twitter account in Mr. Rouhani’s name later stated, “In regards to nuclear issue, with political will, there is a way to rapidly solve the matter.” The account added that Mr. Rouhani had told Mr. Obama, “We’re hopeful about what we will see from” the United States and other major powers “in coming weeks and months.”