A Spanish warship has ordered commercial vessels to leave British waters, Gibraltar’s government said.

The warship’s crew can be heard in an audio recording of a radio exchange on Sunday telling vessels anchored at the Rock to “leave Spanish territorial waters”. Royal Navy boats were deployed in response to the incident.

The boats that had been told to leave were ordered to remain by the Gibraltar Port Authority during the incident, which was branded “foolish” by a spokesman for the government of the British overseas territory.

“There is only nuisance value to these foolish games being played by those who don’t accept unimpeachable British sovereignty over the waters around Gibraltar as recognised by the whole world in the United Nations convention on the law of the sea,” the spokesman said. “It seems there are still some in the Spanish navy who think they can flout international law.”

Gibraltar’s government accused the Spanish ship of trying to take “executive action” against the commercial boats.

A crew member is heard in the recording asking the Spanish ship “to verify you are referring to our ship” because they are anchored in Gibraltar. “We are not adrift – we are at anchor now,” he says, before being told again to leave Spanish waters.

A statement released by the Gibraltar government said: “The Royal Navy deployed a launch and a rigid-hulled inflatable boat to the scene. After being challenged by the Royal Navy, the Spanish warship sailed slowly along the Gibraltar coast with its weapons uncovered and manned.”

The Gibraltar government “is verifying every aspect of the incident in order to ensure that appropriate action is taking as soon as possible”, it said.