Answer:
The Philippines was ruled under the Mexico-based Viceroyalty of New Spain. After this, the colony was directly governed by Spain. Spanish rule ended in 1898 with Spain's defeat in the Spanish–American War. The Philippines then became a territory of the United States.