VIENNA—Key elements of a landmark nuclear agreement between Iran and six world powers were falling into place Sunday, but U.S. Secretary of State John Kerry warned there were important sticking points that may yet scuttle the deal.

Mr. Kerry said the Obama administration could walk away from the negotiations if Iran proves "intransigent" on the remaining issues by Tuesday, the new deadline for a comprehensive agreement aimed at blocking Iran's ability to move swiftly toward nuclear weapons in exchange for easing tight international sanctions.

Senior U.S. and Iranian officials said advances have been made on two of the thorniest issues: the pace of sanctions relief for Iran and a United Nations investigation into charges that Tehran has secretly developed nuclear weapons technologies in recent decades.

European Union foreign-policy chief Federica Mogherini said late Sunday that a final agreement, which has taken more than a decade of diplomacy, was now "very close."

However Mr. Kerry played down expectations of an imminent breakthrough.

"It is now time to see whether or not we are able to close an agreement," Mr. Kerry said. "But I want to be absolutely clear: We are not yet where we need to be on several of the most difficult issues," he added.

"If hard choices get made in the next couple of days—and made quickly—we could get an agreement this week. But if they are not made, we will not."

Mr. Kerry said he agreed with Iranian Foreign Minister Javad Zarif's assessment on Friday that the two sides have never been closer to a deal, but added: "At this point, this negotiation could go either way."

By Sunday evening, Ms. Mogherini, the French, Russian, German and British foreign ministers were all back or headed back to Vienna, where Mr. Kerry and Mr. Zarif continued negotiations over the weekend.

The head of the U.N.'s nuclear watchdog said Saturday that he had agreed with Iran's leadership to conclude an investigation into Tehran's alleged suspected nuclear weapons work by the end of the year.

"With the cooperation from Iran, I think we can issue a report by the end of the year on the assessment of the clarification of the issues related to possible military dimensions," Yukiya Amano, director general of the International Atomic Energy Agency or IAEA, told reporters in Vienna shortly after returning from Iran.

Mr. Amano said Friday that more work would be needed to flesh out details of how Iran would take forward the discussions with the agency. Late Sunday, the IAEA confirmed that senior officials were traveling back to Tehran for fresh talks.

Oil-rich Iran insists its nuclear program is purely for peaceful purposes such as generating electricity.

The IAEA has been seeking Iranian responses to 12 sets of questions it first raised in 2011 about Iran's past nuclear work, based on evidence suggesting Iran may have been developing nuclear weapons technology. The IAEA says that despite promising closer cooperation in November 2013, Iran has so far only partially addressed two of those sets of questions.

The agency says that to date, Tehran has balked at requests to interview key Iranian scientists and to visit alleged nuclear sites.

Iran and the U.S. have also made progress in recent days in addressing the tricky issue of sanctions relief, according to senior U.S. and Iranian officials.

Iran's Supreme Leader Ayatollah Ali Khamenei has publicly demanded most economic and financial sanctions on Tehran be immediately lifted at the time of an agreement. But Iranian negotiators in the past few days have committed in Vienna to a phased approach, where sanctions will be lifted as Iran takes specific steps to roll back its nuclear program.

That includes disconnecting centrifuge machines which enrich uranium—a process that can be used to produce fuel for both nuclear energy or nuclear weapons. Other steps are drastically reducing the country's stockpile of enriched uranium and reconverting its heavy water reactor in the city of Arak so it produces less weapons-usable plutonium.

"On a certain date, Iran will start doing its share, and at the same time, the Americans and the Europeans will commit themselves to terminate sanctions at a certain point," a senior Iranian official said last week. "So the commitment is made beforehand, and the actual termination will happen on the date that Iran will have finished its work."

A senior U.S. official had warned on Friday evening that the July 7 deadline could slip, as the two sides try to narrow differences on several key issues including access to Iranian military sites, Iran's nuclear research rights under a deal and details of Iran's cooperation with the IAEA.

Mr. Kerry and Ms. Mogherini both said Sunday that they wanted a deal done by July 7 although Mr. Kerry refused to rule out more talks after that date.

If Iran and the world powers meet the July 7 deadline, it would mean the U.S. Congress would only get 30 days to review an agreement. However, if no deal is reached before July 9, the U.S. legislature would have an additional 30 days to look over the accord. That would give skeptics more time to rally opposition.

Appearing to anticipate an agreement in Vienna, leaders of the Republican party in Washington stepped up attacks over what they said were going to be weak terms.

Speaking to CBS on Sunday, Sen. Robert Corker (R, Tenn), the chairman of the Senate Foreign Relations committee who crafted the key legislation giving lawmakers a vote on the Iran deal, said the Obama administration must ensure the IAEA wins anytime, anywhere inspections under a final deal.

"I did talk to Secretary Kerry yesterday. I urged him to please take their time. Try to make sure that these last remaining red lines that haven't been crossed—they have crossed so many—do not get crossed and qualitatively they don't' make it worse than where it already is."

Israeli Prime Minister Benjamin Netanyahu accused the six-power group negotiating with Iran of caving in to Iranian demands.

"What is emerging in the nuclear talks is not a breakthrough but a breakdown," Mr. Netanyahu said Sunday during his weekly cabinet meeting. "The deal that is being formulated will pave the path of Iran to create cores of many atomic weapons. It will also enable the flow of hundreds of millions of dollars that will serve the same aggression and its terror campaign—both in the region and throughout the world."

Josh Mitnick in Tel Aviv contributed to this article.

Write to Laurence Norman at laurence.norman@wsj.com and Jay Solomon at jay.solomon@wsj.com

Subscribe to WSJ: http://online.wsj.com?mod=djnwires