President Lula is hoping to persuade his Iranian counterpart to accept a deal
Brazilian President Luiz Inacio Lula da Silva is holding talks with Iran's leaders on the vexed nuclear issue.
The Tehran meeting is being seen as a final attempt to find a compromise.
US officials have warned they are close to securing agreement on a new package of sanctions against Iran in the UN Security Council.
The US and other Western powers accuse Tehran of trying to build an atomic weapon. Iran insists that its nuclear programme is for peaceful purposes.
President Lula arrived from Moscow, where he met Russian President Dmitry Medvedev.
There, he told reporters he was "optimistic" about persuading Iranian President Mahmoud Ahmadinejad to reach an agreement with the West.
"I must now use everything I have learned over my long political career to convince my friend Ahmadinejad to come to an agreement with the international community," he said.
President Lula's visit to Tehran has been described by both senior American and Russian officials as the last chance for a compromise before new sanctions are imposed on Iran.
The Brazilian president will be trying to encourage Iran to agree to a deal under which its existing stocks of enriched uranium are shipped out of the country and converted to fuel for a research reactor, says the BBC's Jon Leyne, reporting from London.
This would prevent the material from being available to make a nuclear bomb.
Turkey's Prime Minister, Recep Tayyip Erdogan, has decided to join the talks amid suggestions that the country might be used as the location for the fuel swap, and is on the way to Tehran.
Our correspondent says Iran has given mixed messages about a fuel swap deal, suggesting that it is still open to the idea, but then imposing conditions the West feels are unacceptable.
Iran has been mounting a big diplomatic effort to prevent the new sanctions - the foreign minister has been travelling to all 15 members of the security council.
But our correspondent says President Ahmadinejad is in a weak position following the dispute over his re-election last year, and it is not clear that he could deliver a compromise deal even if he wanted to.