Iran has the world's fourth-largest oil-reserves and Japan was once one of its key export markets. But Tokyo withdrew from a project to develop Iran's Azadegan oil field after the US and European countries tightened economic sanctions against the country. The field has one of the largest oil deposits in the Middle East.
Over the past five years, Japan has cut crude oil imports from Iran by over half.
In response to the sanctions, Iran threatened to close the Strait of Hormuz at the mouth of the Persian Gulf, one of the world's most important routes for crude oil shipments. The move caused crude oil prices to rise and gasoline prices to jump in Japan.
Resolving the nuclear issue may also pave the way for Japanese firms to enter Iran's market, which has 78 million consumers and rich resources.
Iran's nuclear program first came to light in 2002 when members of the country's opposition revealed the existence of secret nuclear facilities. While Iranian officials said the facilities were for peaceful purposes including power generation, the international community suspected Iran might be developing nuclear weapons.
Since 2006, the United Nations Security Council has adopted resolutions against the country calling for the suspension of its nuclear program.
In 2011, the International Atomic Energy Agency reported that Iran was taking part in activities that were relevant to the development of nuclear weapons. This prompted the US and the European Union to toughen their sanctions, including an import ban on Iranian crude oil.
Israel showed signs of launching preemptive attacks against Iran's nuclear facilities and tensions rose quickly in the Middle East. This fueled speculation that the nuclear issue could become a potential flashpoint for military clashes in the region.
A turning point came in 2013 when Hassan Rouhani took office. The new president called for international dialogue and in November of that year, the country reached an initial agreement with six world powers. The accord called on Iran to limit its uranium enrichment in return for the easement of some economic sanctions.
In April this year, the two sides agreed on a framework that paves the way for a comprehensive agreement. Under the deal, the US and European nations would lift their sanctions once they confirm that Iran has sharply limited its nuclear program.
It was hoped that a final pact could be struck last month. But the deadline was extended three times as negotiations proved difficult.