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 East Indies comprise a wide variety of cultural diversity, and the inhabitants do not consider themselves as belonging to a single ethnic group. Buddhism, Islam, Christianity and Hinduism are the most popular religions throughout the region, while Sikhism, Jainism, Chinese folk religion and various other traditional beliefs and practices are also prominent in some areas. The major languages in this area draw from a wide variety of language families, and should not be confused with the term Indic, which refers only to a group of Indo-Iranian languages from South Asia. The extensive East Indies are subdivided into two sections (from