Iran's President Mohammed Khatami has welcomed what he called a "turning point" in relations with Iraq.
During his visit, Jaafari visited the shrine to Ayatollah Khomeini
He said the current visit by Iraq's transitional PM Ibrahim Jaafari would help patch the wounds inflicted by ex-Iraqi leader Saddam Hussein.
Mr Jaafari is leading the highest-level Iraqi delegation to Iran in decades.
Mr Khatami said the security of Iran and Iraq were closely linked and that Tehran would do everything to help restore Iraq's stability.
"The visit of the Iraqi prime minister to Iran is a turning point in the historic relations between the two countries. It will allow us to heal the wounds and repair the damage caused by Saddam Hussein through joint co-operation," Mr Khatami said.
Mr Jaafari said Iraq knew the evil wrought by Saddam Hussein on the region, but that he did not represent the Iraqi people.
More than one million people died when the two nations fought in the 1980s during an eight-year war.
The political symbolism of restoring relations is huge, says the BBC's Frances Harrison in Tehran.
After decades of no diplomatic relations, Iraq now has a prime minister who has spent years in exile in Iran and heads a Shia-dominated government sympathetic to its neighbour, she says.
More than 10 ministers are accompanying Mr Jaafari on his visit - the first top-level visit to Iran since the Iran-Iraq war.
The two countries have already signed an agreement on expanding transport links - Iran has promised to help rebuild Najaf airport and connect the two countries' rail networks to increase trade and the movement of pilgrims.
They are also expected to discuss security and the control of their long border.
A security agreement would involve Iran sharing intelligence with Iraq, Iraqi Foreign Minister Hoshyar Zebari told the AFP news agency.
"One of the subcommissions we formed is on security co-operation between two sides. Its aim is really to establish a mechanism for intelligence sharing, to prevent infiltrations and to assist us in stabilising the situation," he said.
The two countries have vowed to fight what they called terrorism and the abuse of Islam to justify violence.
"Today, we need a double and common effort to confront terrorism that may spread in the region and the world," Mr Jaafari said at a joint press conference after the talks.
Mr Jaafari, who is scheduled to leave on Monday, is expected to hold further talks with the president-elect of Iran Mahmoud Ahmadinejad, supreme leader Ayatollah Ali Khamenei and Foreign Minister Kamal Kharazi.