The Treaty of Lisbon of 1668 was a peace treaty between Portugal and Spain, concluded at Lisbon on 13 February 1668, through the mediation of England, in which Spain recognized the sovereignty of Portugal's new ruling dynasty, the House of Braganza.
The regent of Spain, queen Mariana of Austria, second wife of the late King Philip IV, acting in the name of her young son Carlos II, oversaw the negotiation on behalf of Spain. The prince-regent of Portugal, Pedro, future king Peter II of Portugal, in the name of his incapacitated brother, Afonso VI, represented Portugal. The peace was mediated by Edward Montagu, 1st Earl of Sandwich, an ambassador of Charles II of England.
By 1640, the Habsburg king, Philip IV of Spain (Philip III of Portugal), could no longer count on the trust, support, or loyalty of most Portuguese nobles. The country was overtaxed and Portuguese colonies had been left unprotected. Portugal, like many of Philip’s domains, was on the verge of open rebellion.
After sixty years of living under the rule of Spanish kings, a small band of conspirators in Lisbon rebelled and the Duke of Braganza was acclaimed king of Portugal as John IV on 1 December 1640, taking advantage of a simultaneous revolt in Catalonia and Spain’s continuing conflict with France. This began the 28-year-long Portuguese Restoration War.
In the beginning, Portugal lost many of its colonial possessions to the opportunistic Dutch. Portugal's military strength was reserved for protecting its own frontiers against Spanish incursions; however, after 1648, with the end of the Thirty Years' War, these misfortunes began to reverse. Portugal regained its colonies in Angola, São Tomé, and Brazil by 1654.