Japan and India signed a controversial civil nuclear deal on Friday that will allow Japanese companies to export atomic technology to the South Asian state as the two countries deepen economic and security ties.

The pact signed by Japanese Prime Minister Shinzo Abe and his Indian counterpart Narendra Modi is Japan's first with a nation that has not signed the Treaty on the Non-Proliferation of Nuclear Weapons (NPT).

The treaty bans nations other than the five permanent members of the UN Security Council from developing and possessing nuclear weapons.

Japan, the victim of US atomic bombings in the final days of World War II, had long shunned civil nuclear cooperation with energy-starved India over the NPT issue.

But it has softened its stance as it competes for lucrative deals and steps up strategic cooperation with New Delhi in the face of China's expanding economic and military presence in the region.

“The agreement is a legal framework to ensure India acts responsibly for the peaceful use of nuclear energy,” Abe told reporters with Modi at his side.

A Japanese official told reporters that the two nations have agreed Japan can cease cooperation if India resumes nuclear testing.

“Today's signing of the agreement for cooperation in peaceful use of nuclear energy marks a historic step in our engagement to build a clean energy partnership,” Modi said.

Besides the US and Japan, India also has similar deals with France and Australia.

The Asian allies have stepped up cooperation in recent years, signing agreements last December on the transfer of defence equipment and technology and on exchanging classified military information.

The nuclear deal comes against the backdrop of growing unease over China's expanding role in the region.

India has a longstanding territorial dispute with China, and troops from the two countries engaged in a major stand-off at the border in 2014.

Tokyo has its own spat with Beijing over islands in the East China Sea, and is increasingly vocal about its rival's ambitions to control almost the whole of the South China Sea.

Modi visited Japan in August 2014 on his first bilateral trip outside South Asia, months after coming to power.

Subsequently Abe paid a two-day visit to India last December.

The Indian leader will wind up his trip in the city of Kobe on Saturday as he and Abe visit a plant that manufactures high speed bullet trains.