China on Friday passed a bill that allows its coast guard to use weapons when foreign ships involved in illegal activities in waters claimed by the country fail to obey orders, state-run media reported, in a move that would complicate relations with its neighbor Japan.

As Beijing claims that the Senkaku Islands, administered by Tokyo, in the East China Sea are part of its territory, the legislation could target Japanese vessels navigating around the uninhabited islets called Diaoyu in China.

Chinese ships have been frequently spotted in the so-called contiguous zone outside Japanese waters, with President Xi Jinping's leadership adopting a hardline posture on the isles under its goal of making the nation a "maritime power."

Supplied photo from China Coast Guard's official Weibo account shows some of its vessels equipped with guns. (Kyodo)

The bill passed by the Standing Committee of the National People's Congress, China's top legislative body, is likely to become a headache for Japanese Prime Minister Yoshihide Suga's government, foreign affairs experts say.

Tokyo has been forced to carefully consider how to get along with Beijing, whose ties with Japan's close security ally, the United States, have deteriorated over several matters, including trade, Hong Kong, Taiwan and the South China Sea.

Then U.S. President-elect Joe Biden, who took office Wednesday, reportedly told Suga in November that Article 5 of the Japan-U.S. security treaty covers the Senkakus, meaning that Washington will defend Tokyo in the event of a conflict there.

Foreign Minister Toshimitsu Motegi on Friday told reporters that Japan will "watch" China's movement "with a high level of interest," adding the country has repeatedly lodged protests against China over activities of its coast guard near the islands.

The latest legislation, which is scheduled to be enacted on Feb. 1, also permits the coast guard to demolish buildings constructed by foreign organizations or individuals in the jurisdictional waters China claims.

Chinese Foreign Ministry spokeswoman Hua Chunying said at a press briefing on Friday that the contents of the bill "conform to international conventions and practices of various nations."

"We will continue to work with relevant countries to properly resolve contradictions and differences through dialogue and consultation to ensure regional peace and stability," she said.

In the early 2010s, China and Japan were mired in a territorial row over the Senkakus. The dispute intensified after the Japanese government of then Prime Minister Yoshihiko Noda brought them under state control in September 2012.

Noda's decision sparked anti-Japanese protests across China. At that time, many Chinese people burned Japanese flags in opposition to Tokyo's nationalization of the islets.

In 2018, Japan and China marked the 40th anniversary of the Treaty of Peace and Friendship, which served as an incentive to forge better ties. Bilateral relations have been improving for years by effectively shelving the territorial spat.

Even after the pandemic of the novel coronavirus, first detected in the central Chinese city of Wuhan in late 2019, China and Japan have maintained relatively amicable ties as they have agreed to work in tandem to resume mutual travel.

Beijing, meanwhile, has rapidly built artificial islands with military infrastructure in the South China Sea, claiming sovereignty over almost the entire maritime area.

China has conflicting territorial claims with four of the 10 members of the Association of Southeast Asian Nations -- Brunei, Malaysia, the Philippines and Vietnam -- as well as Taiwan in the South China Sea.

U.S. warships have carried out "freedom of navigation" operations there in an apparent bid to challenge Chinese claims and actions in the sea, a strategic waterway through which more than one-third of global trade passes.