(Reuters) - China wants to have closer military ties with Iran, the Chinese defense minister told the visiting head of the Iranian navy on Thursday, state media reported, reaffirming diplomatic links despite controversy over Iran's nuclear plans.

Chinese Defense Minister Chang Wanquan told Iranian Navy Commander Rear Admiral Habibollah Sayyari that the two armed forces have seen "good cooperation on mutual visits, personnel training and other fields in recent years", China's official Xinhua news agency reported. 

"Exchanges between the two navies have been fruitful and their warships have paid successful visits to each other," it cited Chang as saying.

"Chang ... stressed China is willing to work with Iran to further pragmatic cooperation and strengthen military-to-military ties."

Xinhua cited Sayyari as saying Iran attached great importance to its ties with China and was "ready to enhance bilateral exchanges to push forward cooperation between the two armed forces, especially in naval cooperation".

For the first time ever, two Chinese warships docked at Iran's Bandar Abbas port to take part in a joint naval exercises in the Gulf, Iranian state media reported on Sept. 20.

Naval cooperation between Iran and China is aimed at reinforcing Iran's military capability in the Gulf, analysts say, as well as displaying China's plan to exert greater influence and presence beyond East Asia.

“The (port) call reflects China’s military-to-military relationship with Iran," said Christian Le Mière, a naval expert at the International Institute for Strategic Studies think-tank.

"It is the most explicit sign of Beijing’s acknowledgment of this relationship, which has remained relatively covert until now." 

China's People's Liberation Army Daily separately reported that Sayyari had been given tours of a Chinese submarine and warships, where he "listened to an introduction on equipment ability and weapons systems".

Sayyari said he hoped Iran and China could cooperate on anti-piracy operations, the newspaper said.

China is Iran's top oil buyer and has been the most aggressive in raising its crude purchases after an easing of the Western sanctions aimed at ending Tehran's disputed nuclear program.

Iran and the United States said last week they made some progress in high-level nuclear talks aimed at reaching a final resolution to the decade-old dispute but that much work remained to clinch a deal by a late-November deadline.

China, a participant at the nuclear talks with Iran, has consistently urged a negotiated solution and decried efforts to place sanctions which have not been endorsed by the United Nations on Iran.

(Additional reporting by Parisa Hafezi in Ankara, Reporting by Ben Blanchard; Editing by Michael Perry)