By the time of Spanish exploration in the 16th century, various indigenous groups occupied the land. The Mapuche, who inhabited south-central Chile, were the most significant and resilient, maintaining their independence through centuries of conflict with Spanish colonizers and later the Chilean state. Their resistance was emblematic of the challenges faced by Spanish conquistadors who arrived in 1540 under the leadership of Pedro de Valdivia. Despite fierce resistance, Valdivia founded Santiago in 1541, marking the beginning of Chile's colonial era.
Chile was part of the Spanish Empire from 1540 to 1818. During this period, the colony developed an economy centered on agriculture and the extraction of natural resources like saltpeter and, later, copper. While these resources bolstered the economy, they also led to over-reliance on commodity exports and tensions with neighboring countries. The War of the Pacific (1879–1884) exemplified such conflicts, as Chile battled Bolivia and Peru over control of the nitrate-rich Atacama Desert.