UN leader Ban Ki-moon said Iran had pledged in talks to play a "positive and constructive role" in efforts to end Syria's civil war.
But the Syrian National Coalition threatened to withdraw from the negotiations, due to start Wednesday in the Swiss town of Montreux, unless the invitation was retracted.
And the United States said Ban should withdraw the invitation unless Iran, a key backer of President Bashar Assad, gives "explicit" support to the conference aim of setting up a transitional government in Syria.
Ban told a news conference he extended a late invitation after intense talks over two days with Iranian Foreign Minister Mohammad Javad Zarif.
"Foreign Minister Zarif and I agree that the goal of the negotiations is to establish, by mutual consent, a transitional governing body with full executive powers," Ban told reporters.
"He assured me again and again that Iran, if they are invited, then they will play a very positive and constructive role," the UN secretary-general added.
Iran's involvement would mean all key countries linked to the worsening war will be among 40 nations at the opening of the peace conference.
Talks between Assad's government and the opposition are due to start in Geneva on Friday.
The Syrian National Coalition only decided on Saturday to attend the conference and reacted with fury to the UN's invitation.
Spokesperson Louay Safi announced on the coalition's Twitter account that the opposition group would withdraw "unless Ban Ki-moon retracts Iran's invitation."
The threat came only hours after international leaders had hailed the coalition's decision to take part in negotiations.
The United States and other Western powers had opposed Iran's attendance at the meeting as long as it refused to accept a communiqué adopted by the major powers in Geneva on June 30, 2012, calling for a transitional government in Syria.
Washington made a new call for a clear signal from Tehran, a financial and military supporter of Assad, that it back efforts to set up a transitional government.
"The United States views the UN secretary general's invitation to Iran to attend the upcoming Geneva conference as conditioned on Iran's explicit and public support for the full implementation of the Geneva communiqué," US State Department spokesperson Jen Psaki said in a statement.
"This is something Iran has never done publicly and something we have long made clear is required."
Up until Ban's announcement, Iran had only said it would go to the peace talks if there was an invitation without conditions.
Ban, who had joined Russia in supporting Tehran's presence, said he expected some kind of statement by the Iranian government.
"I believe strongly that Iran needs to be part of the solution to the Syrian crisis," he said.
If Iran does go, there will be 40 countries and a group of regional bodies at the opening meeting, which will be the most intensive diplomatic effort yet to end a war that the UN says has left well over 100,000 dead.
Ban said that, as host of the peace conference, he also extended last-minute invitations to Australia, Bahrain, Belgium, Greece, Luxembourg, Mexico, the Netherlands, South Korea and the Vatican.
He said the additional countries would be "an important and useful show of solidarity in advance of the hard work that the Syrian government and opposition delegations will begin."
The United States and Russia played key roles convincing the opposition and Assad to send delegations to the conference, which has been pushed back several times.
They will attend alongside the other permanent members of the UN Security Council -- China, Britain and France -- and additional countries suffering fallout from the war, including Iraq, Jordan and Lebanon.
Ban said it was vital for the ministers at the meeting to urge the Syrian protagonists "to act and negotiate in good faith for their own future."
"This violence must stop for humanity and for the future of Syrians," said the head of the United Nations, which has launched its biggest ever operation to help refugees from the conflict and millions inside Syria who have been left homeless and without food.
More than 2.3 million people have fled the country and some 6.5 million are displaced inside Syria.
At least 30 people died there in violence Sunday, including 15 killed when government planes dropped barrel bombs on rebel zones in the northern province of Aleppo, according to the Syrian Observatory for Human Rights.