The state of California was acquired by the United States as part of the Mexican Cession – the land ceded by Mexico to the US in 1848, at the end of the Mexican-American War. The treaty of Guadalupe Hidalgo ended the war, and gave territory to the US. In return, the US agreed to pay $15 million in compensation for damages.
This is the third largest territorial acquisition by the US (after the Louisiana Purchase and the Alaska Purchase) and added the states of California, Nevada, and Utah, and parts of New Mexico, Arizona, Wyoming, and Colorado.
The first Spanish explorers arrived in California in the mid-16th century. These missionaries settled most of modern day Mexico and the US state of California. The cities of San Diego, San Francisco, San Jose, and Los Angeles crystallized around the Spanish pueblos and Christian missions of the time.
After a long struggle for independence, Mexico was finally accepted as a sovereign nation by Spain in August 1821. This new Mexican Republic included all of California, but in a few decades, an independence movement started taking roots in California. By 1846, American settlers in Sonoma took advantage of the Bear Flag Revolt to declare California’s independence from Mexico. The same year, the US declared War on Mexico, and by 1847, Mexico had signed the Treaty of Guadalupe Hidalgo, which outlined the terms of ceding a vast territory (Southwest US) which is referred to as the Mexican Cessation.
On September 9th, 1850, California was admitted as the 31st state of the US.