The Ramon Margalef, an oceanographic survey ship, entered the waters off the tiny peninsula yesterday but would not move despite repeated requests, said Britain's Foreign Office.
"I strongly condemn this provocative incursion and urge the Spanish government to ensure that it is not repeated," said Europe Minister David Lidington.
"We stand ready to do whatever is required to protect Gibraltar's sovereignty, economy and security."
He added: "We believe that it is in the interests of Spain, Gibraltar and Britain to avoid incidents such as this that damage the prospects for establishing dialogue and cooperation."
Also Read
"Despite repeated diplomatic protests to Spain in relation to incursions into British Gibraltar territorial waters in recent months, a Spanish state research vessel, the RV Ramon Margalef, undertook significant surveying activity in British Gibraltar territorial waters on 18 and 19 November for over 20 hours," Lidington said.
"When challenged by radio, the vessel responded that it was conducting survey work with the permission of the Spanish authorities and in the interests of the European Community."
Spain ceded Gibraltar to Britain in perpetuity in 1713 but has long argued that it should be returned to Spanish sovereignty.