Britain has expressed deep concern after Spain confirmed that one of its customs vessels fired live rounds during a dispute with a pleasure boat in UK territorial waters off Gibraltar.
The Foreign Office said it had been reassured that Spanish law enforcement officials would show the "utmost respect" in future for protecting lives.
Both countries have also agreed to "step up" cooperation against organised crime, including giving "timely" notice of pursuits of suspect vessels and exchanging evidence.
A formal complaint was lodged after two men fishing off the coast of the British overseas territory complained that the crew of the customs boat had "fired in their direction".
Gibraltar's First Minister Fabian Picardo said the incident occurred "well inside" territorial waters and represented an "extremely serious escalation" of "repeated Spanish violations of British-Gibraltar sovereignty".
He said customs officials attempted to board the pleasure boat after it failed to stop its engines when demanded and during the operation shots were fired into the sea near the boat.
It was, he added, the third incident involving a Spanish customs vessel in as many weeks.
In a statement, the Foreign Office said it had received "a full explanation of the incident on 22 August".
It went on: "We remain deeply concerned at the fact that live shots are now confirmed to have been fired during this incident and we have been reassured by the Spanish Government that safety of lives at sea is a top priority for all concerned and their law enforcement agencies will operate with the utmost respect for this principle in order that this is fully upheld in the future.
"Without prejudice to our respective positions on questions of sovereignty and jurisdiction, it has been agreed to step up law enforcement cooperation in the fight against organised crime, including through timely co-operation and notification by the various seaborne agencies of pursuits of vessels involved in illegal activities to ensure effective action against criminals and a commitment to a mutual provision and exchange of evidence in order to better facilitate the successful prosecution of criminals in the relevant courts and tribunals."
Earlier this month the UK Government accused Spain of "a clear violation of UK sovereignty" after complaining that boats and helicopters had been sent into British waters off Gibraltar.
Ministers said repeated incursions were "completely unacceptable and unlawful under the international law" and pledged to urgently raise the matter with the Spanish.
A row broke out after Spanish state vessels chasing suspected drug smugglers made forays into waters around Gibraltar.