VIENNA -- Overcoming decades of hostility, Iran, the United States, and five other world powers struck a historic accord Tuesday to check Tehran's nuclear efforts short of building a bomb. The agreement could give Iran access to billions in frozen assets and oil revenue, stave off more U.S. military action in the Middle East and reshape the tumultuous region.

The deal sets in motion a years-long test of Iran's willingness to keep its promises to the world -- and the ability of international inspectors to monitor compliance. It also sets the White House up for a contentious fight with a wary Congress and more rocky relations with Israel, whose leaders furiously opposed the agreement.

Appealing to skeptics, President Barack Obama declared that the accord "offers an opportunity to move in a new direction. We should seize it."

Under terms of the deal, the culmination of 20 months of arduous diplomacy, Iran must dismantle much of its nuclear program in order to secure relief from biting sanctions that have battered its economy. International inspectors can now press for visits to Iran's military facilities, though access is not guaranteed. Centrifuges will keep spinning, though in lesser quantities, and uranium can still be enriched, though at lower levels.

In a key compromise, Iran agreed to continuation of the U.N.'s arms embargo on the country for up to five more years and ballistic missile restrictions for up to eight years. Washington had sought to keep the arms ban in place, while Russia and China joined Iran in pushing for an immediate suspension.

On the streets of Tehran, Iranians honked their horns and celebrated in the city's main square. President Hassan Rouhani said a "new chapter" had begun in his nation's relations with the world, even as he denied Iran had ever pursued a nuclear weapon.

While the U.S. partnered in the talks with Britain, France, Germany, Russia and China, the decades of tensions between the U.S. and Iran put the two countries at the forefront of the negotiations.

Whether the nuclear rapprochement will spark a broader thaw is unclear. Nearly 40 years after Iran's Islamic revolution and the hostage-taking at the U.S. Embassy in Tehran, the country's hardliners remain hostile toward Washington. The U.S. and its allies also have deep concerns about Iran's support for terrorism in the Middle East and its detention of several American citizens.

With key restrictions on Iran's nuclear program required for only a decade, opponents of the deal say it simply delays Tehran's pursuit of the bomb. Critics also say Iran will use new wealth from sanctions relief to double-down other destabilizing activities in the region.

Iran stands to receive more than $100 billion in assets that have been frozen overseas and benefit from an end to various financial restrictions on Iranian banks. Iran could also sell more oil, bringing down crude prices.

Israeli Prime Minister Benjamin Netanyahu, who lobbied unceasingly against a deal, called it a "stunning historic mistake" and warned that his country would not be bound by it. Netanyahu strongly hinted that Israeli military action to destroy Tehran's nuclear program remains an option.

Obama and Netanyahu, who have long had a cool relationship, spoke by phone Tuesday. White House officials said Obama also called King Salman of Saudi Arabia, one of the many Sunni Arab rivals of Shiite Iran who have expressed concerns about the deal.

On Capitol Hill, Republicans accused Obama of making too many concessions. House Speaker John Boehner of Ohio said lawmakers "will fight a bad deal that is wrong for our national security and wrong for our country." GOP presidential hopefuls also panned the deal, some vowing to scrap it if elected to succeed Obama.

Obama did get a crucial show of support from Hillary Rodham Clinton, his former secretary of state and the likely Democratic presidential nominee. She praised the deal as an important step toward "putting the lid on Iran's nuclear program."

Clinton's support could give some Democratic lawmakers more confidence in standing with Obama as he tries to hold off congressional efforts to disrupt the deal. Congress has 60 days to review it and can try to prevent Obama from waiving sanctions on Iran as promised in the negotiations.

The president reiterated that he would veto any legislation aimed at upending the agreement. Defending it, he said, "No deal means a greater chance of more war in the Middle East."

The deal comes after years of international diplomacy that until recently were defined by failure. Breaks in the talks sometimes lasted for months, and Iran's nascent nuclear program expanded into one that Western intelligence agencies saw as only months away from weapons capacity. The U.S. and Israel both threatened military action.

Obama took office in 2009 promising to keep the door open for greater engagement with Iran, even as he ratcheted up economic sanctions. In 2012, he authorized secret talks that helped lay the groundwork for the formal negotiations that stretched over the past two years.

The final weeks were marked by marathon meetings in Vienna, three blown deadlines and threats by top American and Iranian diplomats to walk away.

Secretary of State John Kerry, who did most of the bargaining with Iranian Foreign Minister Mohammad Javad Zarif, said persistence paid off. "Believe me, had we been willing to settle for a lesser deal we would have finished this negotiation a long time ago," he said.

In a statement from Ottawa, Foreign Affairs Minister Rob Nicholson said Canada appreciates efforts to reach the agreement, but said that Iran "continues to be a significant threat to international peace and security" and that Canada will judge Iran by its actions not its words.

"We will examine this deal further before taking any specific Canadian action," said the statement.

The breakthrough came after several key compromises.

Iran agreed to a continuation of the arms embargo for up to five more years, though it could end earlier if the International Atomic Energy Agency clears Iran of any current work on nuclear weapons. A similar condition was put on U.N. restrictions on the transfer of ballistic missile technology to Tehran, which could last for up to eight more years, according to diplomats.

Washington had sought to maintain the ban on Iran importing and exporting weapons, concerned that an Islamic Republic flush with cash from sanctions relief would expand its military assistance for Syrian President Bashar Assad's government, Yemen's Houthi rebels, the Lebanese militant group Hezbollah and other forces opposing America's Mideast allies such as Saudi Arabia and Israel.

Another significant agreement will allow U.N. inspectors to press for visits to Iranian military sites as part of their monitoring duties, something Iran's supreme leader, Ayatollah Ali Khamenei, has opposed. However, access isn't guaranteed and could be delayed, a condition that critics of the deal are sure to seize on.

Under the accord, Tehran would have the right to challenge U.N requests, and an arbitration board composed of Iran and the six world powers would then decide. The IAEA also wants to complete its long-stymied investigation of past weapons work by Iran, and the U.S. says Iranian co-operation is needed for all economic sanctions to be lifted.

IAEA chief Yukiya Amano said Tuesday his agency and Iran had signed a "roadmap" to resolve outstanding concerns, hopefully by mid-December.

------

Julie Pace reported from Washington. AP writers Bradley Klapper, Josh Lederman, Darlene Superville and Connie Cass in Washington, Josef Federman in Jerusalem and Nasser Karimi in Tehran contributed to this report.

Highlights of the nuclear deal between Iran and 6 world powers

VIENNA -- Iran and six world powers reached a landmark nuclear deal on Tuesday meant to curb Iran's nuclear program in exchange for sanctions relief. A look at the main points:

ENRICHMENT: Iran will reduce the number of uranium-enriching centrifuges it has from almost 20,000 to 6,104, and reduce the number of those in use from nearly 10,000 to half that. It also commits to using only its current models, rather than more advanced centrifuges it had wanted to install.

STOCKPILE: Iran committed to reducing its stockpile of enriched uranium from about five tons to 300 kilograms (less than 700 pounds) for 15 years. U.S. officials say that at this level it would take Iran more than a year to enrich enough uranium for a nuclear weapon.

UNDERGROUND SITE: Iran committed to convert its Fordo enrichment site -- dug deep into a mountainside and thought impervious to air attack -- into a research centre.

TRANSPARENCY: Iran will give more access to its nuclear program to the U.N. nuclear agency. If that agency identifies a suspicious site, an arbitration panel with a Western majority will decide whether Iran has to give the agency access within 24 days.

REACTORS AND REPROCESSING: Iran must redesign its nearly built reactor at Arak so it can't produce plutonium for nuclear weapons.

SANCTIONS: All U.S. and European Union nuclear-related sanctions will be suspended after experts have verified that Iran is hewing to its commitments. If at any time Iran fails to fulfil its obligations, those sanctions will snap back into place. An arms embargo will stand for five years and restrictions on Iran's ballistic missile programs for eight. Iran will get some access to currently restricted sensitive technologies.