The Treaty of Utrecht
Philip V remained king of Spain. However, Spain and France would never allowed to be united.
Austria gain territories in Spanish Netherlands, Milan and Naples.
England kept Gibraltar and Minorca, also gain substantial French territories in North America and Caribbean. Bristish also extracted from Spain the right to transport and sell African slaves in Spanish America.