MANILA - The Philippines foreign minister on Wednesday said a diplomatic protest had been filed over China's passing of a law allowing its coastguard to open fire on foreign vessels, describing it as a "threat of war".

China passed legislation on Friday allowing its coastguard to use "all necessary means" to stop or prevent threats from foreign vessels, including demolishing other countries' structures built on Chinese-claimed reefs. 

"After reflection I fired a diplomatic protest," Philippines' foreign minister, Teodoro Locsin, said on Twitter.

"While enacting law is a sovereign prerogative, this one —given the area involved or for that matter the open South China Sea — is a verbal threat of war to any country that defies the law; which, if unchallenged, is submission to it," he added.

China's embassy in Manila did not immediately respond to a request for comment.

The law, which permits coastguard to board and inspect foreign vessels in waters China considers its own, could pose problems given the scope of Beijing's territorial claims in the South China Sea.

China's claim of 90% of the strategically important waterway was invalidated by an international arbitration tribunal in 2016, but it does not recognise that ruling.

China maintains a constant presence of coastguard hundreds of kilometres off its mainland, near disputed island and often within the Exclusive Economic Zones (EEZ) of its neighbours, some of which accuse the vessels of aggressive behaviour, like disrupting fishing and energy exploration activities.

Taiwan, Malaysia, Vietnam, the Philippines and Brunei also have competing claims with China.

The Philippine protest comes days after ally the United sent a carrier group through the waterway to promote "freedom of the seas". China on Tuesday said it would hold military drills of its own this week. 

A spokesman for President Rodrigo Duterte on Monday said the Philippines hopes no country will do anything to increase tensions.

(Reporting by Neil Jerome Morales; Editing by Martin Petty) ((neiljerome.morales@thomsonreuters.com; +632 8841 8914;))