On this day in 1779, Spain declares war on Great Britain, creating a de facto alliance with the Americans.
Spain's King Charles III would not consent to a treaty of alliance with the United States. For one imperial power to encourage another imperial power's colonies in revolt was a treacherous game, and he was unwilling to play. However, French Foreign Minister Charles Gravier, comte de Vergennes, managed to negotiate a treaty with Spain to join their war against the British. As the ally of the United States' ally, Spain managed to endorse the revolt at a critical diplomatic distance.
The American Revolution had already spawned a world war between the two international powers of Britain and France. Spain's entry into the imbroglio ensured that the British would have to spread their resources even thinner. King Charles wanted to reclaim Gibraltar for Spain and secure Spanish borders in North America and the Spanish immediately laid siege to Gibraltar at the mouth of the Mediterranean Sea. The British managed to drive the Spanish from Gibraltar on February 7, 1783, having constructed an 82-foot-long tunnel into the north face of the rock of Gibraltar, known as the "Notch," in order to supply it with cannon. However, King Charles succeeded in his North American goals. The Spanish took West Florida by force and attained East Florida by cession when the War for Independence ended; they were also able to secure the Gulf of Mexico.
Taken from: http://www.history.com/this-day-in-history/spain-declares-war-against-great-britain [21.06.12]