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, tensions between the U.S. and Iran put the two countries at the forefront of the negotiations.

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.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.

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.