Texas is a state of the United States, the largest in the Lower 48. Texas borders New Mexico to the west, Oklahoma to the north, and Arkansas and Louisiana to the east. It has a long coastline on the Gulf of Mexico, and a long border with Mexico along the Rio Grande. Its capital is Austin, although Dallas, Houston, and San Antonio are larger in population. Texas was a part of the Spanish Empire and later Mexico until 1836, when it won its independence. In the 1840s, Texas was annexed by the United States. Texas fought for the Confederacy during the American Civil War. The discovery of petroleum in the early 20th century led to increased prosperity and population.