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.
Spanish East Indies of Luzon remained outside Spanish control until the early 19th century, and the southernmost tip of Palawan, not until the late 1890s. The rest of Mindanao (Caesarea Karoli)—aside from outposts in Northern Mindanao, Zamboanga, Cotabato, and the islands of Basilan and Jolo, the rest was nominally under Spanish control, recognizing Spanish rule, but left to administer their own affairs, as in the cases of the Sulu, and the Maguindanao sultanates, as well as a number of other Lumad tribes not affiliated with either. Similarly, Palau and the vast majority of the Caroline Islands were not governed by Spanish missions until