VIENNA—World powers failed to reach a nuclear agreement with Iran and extended talks for seven months, exposing deep divides between the sides and putting the diplomatic effort at risk from domestic discord in the nations involved.

After negotiators failed Monday for the second time this year to meet a deadline for a deal, diplomats said they needed until the end of June 2015 to finalize the terms. They agreed to roll over an interim agreement signed last year that caps some of Iran’s nuclear work in exchange for an easing of Western economic sanctions.

Secretary of State John Kerry lobbied for the extension at the latest round of talks in Vienna, arguing significant progress had been made and a breakdown in negotiations risked further destabilizing the Middle East.

Related

“The nuclear program in Iran as we negotiate is frozen,” Mr. Kerry told reporters at the end of a week of exhaustive negotiations with his Iranian counterpart, Javad Zarif. “We would be fools to walk away from a situation where the breakout time has already been expanded rather than narrowed, and where the world is safer because this program is in place.”

The U.S. and its allies suspect Iran’s nuclear work is aimed toward producing a weapon, something Tehran has repeatedly denied.

The extension leaves the process vulnerable to greater domestic opposition in the U.S. Republican lawmakers poised to gain control of the U.S. Congress in January quickly challenged the Obama administration’s right to continue its Iranian outreach.

A number of senators called for the quick imposition of new economic sanctions on Iran, citing the lack of an agreement despite more than a year of talks.

Iranian officials have said they’ll pull out of the diplomacy if these new financial penalties are put in place.

Still, there were measured tones in both Washington and Tehran on Monday, with some Republicans saying they’d back a continued dialogue with Tehran. But they stressed Congress will demand much greater controls over White House diplomacy.

“I would rather the administration continue to negotiate than agree to a bad deal that would only create more instability in the region and around the world,” said Sen. Bob Corker (R., Tenn.,), who’s expected to be the next chairman of Senate Foreign Relations Committee.

“Congress must have the opportunity to weigh in before implementation of any final agreement and begin preparing alternatives, including tougher sanctions, should negotiations fail.”

In Iran, President Hasan Rouhani said in an address to the nation that the extension was a victory, adding negotiations will lead to a deal, “sooner or later.”

More From WSJ

Iran’s Supreme Leader
Ayatollah Ali Khamenei
is seen as opposed to concessions necessary for a nuclear deal, and is wary of the foreign money and interests that could flow into Tehran if sanctions are lifted, according to Iranian economists.

Nonetheless, U.S. officials saw Mr. Rouhani’s comments Monday night as a sign that Mr. Khamenei backed the current direction of the talks.

Mr. Zarif addressed Mr. Khamenei’s role.

“It’s not that our hands are tied,” he said in Vienna. “We have quite a bit of flexibility. We have exercised and shown flexibility in order to move this process forward.”

After 14 months of negotiations, the two sides were unable to bridge gaps on two key issues: the future size of Iran’s nuclear-fuel production capacity and the pace at which sanctions will be lifted, according to U.S. and Iranian officials.

They will continue to work in the coming months to narrow those divides.

Negotiators said they believe it would take three or four months to work out a deal and another few months to formalize it. In the meantime, they are pressing Iran to agree to new steps to make its nuclear activities more transparent, hoping to allay fears the country will use the extension to advance the nuclear program.

Mr. Zarif said he hoped his country could move much faster to reach agreement with the U.S., U.K., France, Russia, China and Germany.

“All of us are insisting that we don’t even need seven months and we believe we can do it much faster than that,” he said. “We will not be waiting until June. We will not be waiting until March…We will not waste any time.”

U.S. officials have voiced concerns that a breakdown in negotiations could raise pressure on the U.S. to bomb Tehran’s nuclear sites and lead Iran to try and sabotage American military operations in the region.

Israeli Prime Minister Benjamin Netanyahu welcomed an extension of talks, saying it was a much better result than signing a “bad deal” with Tehran.

“The right deal that is needed is to dismantle Iran’s capacity to make atomic bombs and only then to dismantle the sanctions. Since that’s not in the offing, this result is better, a lot better,” he said.

U.S. companies, long accustomed to prohibitions in doing business with Iran, said Monday they would rather wait additional months to get a deal with everyone on board—including the Europeans and domestic political skeptics—than see the talks fall apart or result in a contentious outcome.

“The bottom line is, given where U.S. based companies have been for so long with respect to Iran, we don’t oppose the extension of the negotiations, because we still want to see successful negotiations,” said Richard Sawaya, director of USA Engage, a coalition of business groups that opposes unilateral sanctions.

U.S. and international sanctions have crippled Iran’s economy, cutting its daily oil exports by more than half, and freezing the ability of Iranian banks to conduct international transactions. A plunge in global energy prices are further eating into Tehran’s budget, and undercutting Mr. Rouhani’s programs for economic revitalization.

Even with increased buy-in from Tehran, the Obama administration’s faces questions over its ability to maintain unity among its widely varied diplomatic partners while negotiations are open.

Diplomats from the U.S. and France have clashed in recent weeks as Paris objected to concessions being considered by Washington, according to diplomats involved in the Vienna process.

French officials said they were blindsided by a secret letter President Barack Obama wrote last month to Mr. Khamenei, describing shared security interests between Tehran and Washington.Iran and global powers are scheduled to resume talks next month at an undecided location.

Russian President Vladimir Putin, meanwhile, remains a wild card in the diplomacy. U.S. and European officials have hailed Moscow’s cooperation and its willingness to take part in a united front. But Russian officials have increasingly spoken against Western sanctions and detailed extensive joint-Iranian-Russian business projects that are being pursued, which cast doubt on Washington’s ability to keep Iran isolated economically.

Mr. Putin spoke Monday with Mr. Rouhani after talks concluded and praised the progress, according to the Russian government.

Mr. Khamenei has publicly stated that Iran needs more than 100,000 centrifuge machines for the enrichment of uranium to fuel Tehran’s power sector. The Obama administration has negotiated Tehran down to below 10,000 during the recent talks, but an exact number has yet to be reached. Iran has also been calling for the immediate repeal of U.N. sanctions and quick rollbacks of U.S. and European financial penalties. U.S. officials have said Mr. Zarif has accepted that the process of dismantling sanctions will likely take longer.

Mr. Kerry said Tehran over the coming seven months will continue to receive $700 million a month from Iranian oil revenues frozen in overseas accounts, economic relief agreed to last year as part of the interim agreement.

Mr. Kerry voiced optimism that an extended negotiating process could breed results. He said a “political” agreement”—which is expected to be a broad statement on the future of Iran’s nuclear program—could be ready in four months. The final details would then be ironed out by June, he said.

“At the end of four months…if we have not agreed on the major elements by that point in time and there is no clear path, we can revisit how we then want to choose to proceed,” Mr. Kerry said. “We believe a comprehensive deal that addresses the world’s concerns is possible.”

Many Iran experts believe Mr. Obama’s Iran diplomacy has morphed into a framework and an incentive for broader Iranian cooperation in other arenas.

In the president’s letter to Mr. Khamenei, he outlined the possibility of the U.S. and Iran cooperating in fighting Islamic State militants who have gained control of territories in Iraq and Syria, according to people briefed on the correspondence.

“Between now and January 2017, Obama wants to avert an Iranian bomb and avert bombing Iran,” said Karim Sadjadpour, an Iran expert at the Carnegie Endowment for International Peace in Washington. “Extending negotiations is not ideal but it checks both these boxes.”

—Michael R. Crittenden, William Mauldin, and James Marson contributed to this article.