Spain colonized the Philippines for about 333 years, from the arrival of Miguel López de Legazpi in 1565 until the end of Spanish rule in 1898 following the Spanish-American War and the Treaty of Paris. Spanish rule began with the establishment of the first permanent Spanish settlement in Cebu in 1565 and lasted until the Philippines was ceded to the United States in 1898.