Japan lodged a formal protest with Beijing on Friday after determining that a nuclear submarine that entered its territorial waters without identifying itself belonged to China.

Japan's navy had been on alert since Wednesday, when the submarine was first spotted off the nation's southern island of Okinawa (search). Tokyo sent reconnaissance aircraft and naval destroyers to shadow the submarine, which spent about two hours inside Japanese waters before heading north.

Foreign Minister Nobutaka Machimura (search) summoned Chinese envoy Cheng Yong-hua to formally protest the incursion and demand an explanation, a ministry spokesman said on condition of anonymity.

Cheng said Chinese authorities were investigating the incident and he would pass the protest on to Beijing, the spokesman said. Kyodo News Agency quoted Cheng as saying he could not immediately offer an apology.

The dispute comes even as Chinese and Japanese officials try to arrange a meeting between Koizumi and Chinese President Hu Jintao on the sidelines of the Asian Pacific Economic Cooperation (search) summit in Chile later this month.

The two have not met this year, and there have been no reciprocal visits by the leaders of the neighboring countries since October 2001 — a frostiness apparently caused by Koizumi's repeated visits to a Tokyo war shrine that China says glorifies Japan's brutal aggression during World War II.

Koizumi said Friday he did not expect any long-term damage to Japan-China relations.

"Our relations with China are important, so both sides must make an effort so that they are not negatively affected," he said. "The summit is the summit, and we should go ahead with it keeping in mind what is beneficial to both countries."

Defense Agency chief Yoshinori Ono lifted Japan's naval alert on Friday, Hosoda said. He did not specify whether the aircraft and destroyers were returning home.

On Thursday, China's Foreign Ministry spokeswoman Zhang Qiyue said she did not know if the vessel was Chinese and discouraged "any random suppositions on this questions."

Territorial disputes have occasionally flared up between Japan and its neighbors — China, South Korea and Russia.

Tokyo recently accused China of conducting surveys for gas fields that extend into Japanese territorial waters, and in September it revived a dispute with Moscow over tiny, frozen islands in the North Pacific that Russia has occupied since World War II.

Japan has been considering ways to boost its maritime defenses after a shootout with a suspected North Korean spy ship in December 2001.