In 1804, a British squadron engaged and defeated a Spanish force sailing from Peru to Spain, causing Godoy to again declare war on Britain. On October 21, 1805, the French and Spanish fleets suffered a humiliating defeat at the Battle of Trafalgar, ending Spain's last bid to be a world power.