Incidents of this nature are not uncommon, but this one comes after a row broke out over Gibraltar last week when the European Union said that Spain should have a veto on extending any trade deal to the territory after Britain leaves the bloc.
Fearing that Spain is trying to take advantage of Brexit to impose its control over the 32,000-strong rocky outcrop on the country's southern tip, Gibraltar reacted angrily, and London pledged its support for a territory ceded to Britain in 1713 but long claimed by Madrid.
Spain, meanwhile, voiced surprise at Britain's tone, and the EU's Brexit negotiator Michel Barnier urged London to "keep calm and negotiate."
On Tuesday, the Spanish Navy corvette Infanta Cristina sailed slowly past the Rock about a mile from shore, prompting the Royal Navy to dispatch a patrol boat to the area.
Britain claims three miles of sea around Gilbraltar but Spain says the waters are Spanish.
"Today's illegal incursion by a Spanish naval vessel is a timely demonstration of the way in which Spain routinely conducts itself in breach of the UN Convention on the Law of the Sea," a spokesman for Gibraltar's government said.
A British government spokesman, meanwhile, said "the Royal Navy challenges all unlawful maritime incursions into British Gibraltar territorial waters."
"We back this up by making formal diplomatic protests to the Spanish government."
These types of incursions are fairly common in Gibraltar.
Last November, in response to a question from Conservative peer Lord Patten in the House of Lords, the British government said there had been 434 incursions by Spanish state vessels into Gibraltar waters in the 12 months to October 31st, 2016, the most recent data available.