Spanish East Indies together with the Spanish West Indies, were administered through the Viceroyalty of New Spain based in Mexico City. After Mexican independence, they were ruled directly from Madrid. As a result of the Spanish–American War in 1898, the Philippines and Guam were occupied by the United States while about 6,000 of the remaining smaller islands were sold to Germany in the German–Spanish Treaty of 1899. The few remaining islands were ceded to the United States when the Treaty of Washington was ratified in 1901. Spanish contact began on , when a Spanish expedition led by Ferdinand Magellan reached the Mariana Islands.
East Indies and early 16th century led by the Portuguese explorers. The Portuguese described the entire region they discovered as the "Indies". Eventually, the region would be broken up into a series of "Indies": The East Indies, which was also called "Old Indies" or "Great Indies", consisting of India, and the West Indies, also called "New Indies" or "Little Indies", consisting of the Americas. These regions were important sources of trading goods, particularly cotton, indigo and spices after the establishment of European trading companies: the British East India Company and Dutch East India Company, among others, in the 17th century. The New