President Ahmadinejad's visit has been criticised by Israel
Brazil has reaffirmed its support for Iran's right to a civilian nuclear programme, but called for a "just and balanced" solution with the West.
During a visit to Brazil by the Iranian president, President Luiz Inacio Lula da Silva criticised attempts to isolate Iran over its nuclear ambitions.
But he also urged Mahmoud Ahmadinejad to engage with the West.
Western powers fear Iran is developing nuclear weapons technology, rather than civilian uses as it claims.
It is the first visit by an Iranian president to Brazil, which maintains close ties to the US, Israel and other countries trying to block Iran's nuclear ambitions.
But Brazilian President Lula said he opposes further sanctions on Iran, and called for diplomacy instead.
"We recognise Iran's right to develop a peaceful nuclear programme in compliance with international accords.
"I encourage you to continue engaging interested countries to seek a just and balanced solution on the Iranian nuclear issue," he said to Mr Ahmadinejad at a press conference.
Iran has yet to respond to a plan brokered by the International Atomic Energy Agency, and agreed by Russia, the US and France last month.
Under the plan most of Iran's enriched uranium would be sent abroad to be turned into fuel rods for research use.
This is seen as a way for Iran to get the fuel it needs, while giving guarantees to the West that it will not be used for nuclear weapons.
Mr Ahmadinejad's visit to Brazil has already drawn criticism from Israel and members of the US Congress.
US State Department spokesman Robert Wood declined to comment on the meeting, but before the event, he said he hoped Brazil would raise some of the US concerns with the Iranian leader.
New York congressman Eliot Engel said President Lula was making "a serious error" by "lending legitimacy" to Mr Ahmadinejad.
Israel too called it a "mistake" for Brazil to host him, AFP reports.
Since coming to power in 2005, Mr Ahmadinejad has sought to build ties with leftist south American leaders.
His five-nation tour also takes him to Venezuela and Bolivia, with stops in the West African countries of Senegal and Gambia on the way home.