A Western source with knowledge of the negotiations confirmed that there has been an agreement. “Yes, there is agreement,” said the source who declined to be identified.
The agreement aims to limit Iran's nuclear work for more than a decade in exchange for the gradual suspension of sanctions that have slashed Iran's oil exports and crippled its economy.
“All the hard work has paid off and we sealed a deal,” one diplomat told Reuters on condition of anonymity. A second Iranian official confirmed the agreement.
The Foreign Ministers of Iran and the six powers will meet at 0830 GMT at the United Nations centre in Vienna and a news conference will follow, a spokeswoman for the European Union said on Tuesday.
Iran's Foreign Minister, Mohammad Javad Zarif, and EU's Foreign Policy Chief Federica Mogherini are expected to read a joint statement, diplomats said.
Under a draft version of the nuclear deal, sketched out in preliminary form on April 2, UN inspectors would have access to all suspect Iranian sites, including military ones, a diplomatic source said.
The Foreign Ministers of Britain, China, France, Germany, Russia and the United States met for about an hour just after midnight as they struggled to complete the agreement, which has been under negotiation for more than 20 months.
The accord could mark a watershed in Tehran's relations with Western nations, which suspect that Iran has used its civil nuclear program as a cover to develop a nuclear weapons capability. Iran denies this.
Among the biggest sticking points in the past week was Iran's insistence that a United Nations Security Council arms embargo and ban on its ballistic missile program dating from 2006 be lifted immediately if an agreement is reached.
Russia, which sells weapons to Iran, has publicly supported Tehran on the issue.
Another major stumbling block was the so-called "snapback" plan to restore the sanctions if Iran violates the deal. It was not immediately clear how those issues were finessed in the final agreement.
Other problematic issues include access for inspectors to military sites in Iran, explanations from Tehran of past activity that might have been aimed at developing a nuclear weapon and the overall speed of sanctions relief.
The source said a UN Security Council resolution would ideally be adopted in July and steps to be taken by both sides - including Iranian limitations on its nuclear program and relief from sanctions on Iran - would be implemented in the first half of 2016.
The information from the source was preliminary and subject to change because it was based on a draft not the final version that could be amended before final approval by Iran and the six powers.
The source said Iran and the UN International Atomic Energy Agency have agreed a plan to address outstanding questions about the possible military dimensions of past Iranian nuclear activity by the end of 2015, noting that some sanctions relief would be subject to Tehran resolving this issue.
The plan includes one visit to the Parchin military site as well as possible interviews with Iranian nuclear scientists, the source noted.