New Spain (in the Spanish language Nueva Espaņa) was the name given to the Spanish colonial territory in North America from c. 1525 to 1821. The Capital of New Spain was Mexico City. New Spain was ruled by a Viceroy appointed by the King of Spain. The territory of New Spain included all of what is now Mexico, Central America down to the southern border of Costa Rica, and portions of the United States including the current states of California, Arizona, New Mexico, and Texas. The northern boundary of New Spain remained undefined until the Adams-Onis Treaty in 1819. In 1821 Spain lost most of the territory, except for Cuba and Puerto Rico, with the independence of Mexico.
The Philippines were administered as a colony of New Spain.