In pre-Columbian times the territory now occupied by the state of San Luis Potosí contained the cultural areas of Mesoamerica and Aridoamerica. Its northern and western-central areas were inhabited by the Otomi and Chichimeca tribes. These indigenous groups were nomadic hunter-gatherers. Although most natives died during the Spanish settlements, huasteco groups still live, along with pame and náhuatl although their numbers are significantly small.
In 1592, gold and silver deposits were discovered which triggered the establishment of the state. Spanish miners established the first town known as “San Luis de Mezquitique”, modern location of the capital San Luis Potosí. This led to the first mayor being appointed, Juan de Oñate.
The State was given the name "San Luis Rey", King Saint Louis, in honor of Louis IX of France, and "Potosí" because the wealth of the state compared to the rich silver mines in Potosí, Bolivia. Settlers hoped of rivaling the Bolivian mine wealth, but this was never truly accomplished. In the 17th and 18th centuries, Franciscans, Augustinians, and Jesuits arrived in the area and settled, then began to build churches and buildings, many of which are still standing and have been turned into museums and universities.
In mid-1821, after the Independence of Mexico, General Jose Antonio Echavarri intimidated and threatened the Mayor and the City Council to surrender the city of San Luis to the Army of the Three Guarantees of Agustín de Iturbide (Ejercito de las Tres Garantias de Iturbide), who at the time was emperor of Mexico. They submitted to his demand, as there was no way to resist, and thus proclamation of Independence of San Luis Potosí was declared. The first Constitution of San Luis Potosí was then written on October 16, 1826, and this was in effect until 1835 when Congress proclaimed it centralist. At this point, local legislatures disappeared and state governors were appointed by the central government. This situation lasted until the promulgation of the 1857 Constitution.
The state participation in the Mexican–American War in the years of 1846-1847 gave it the name "San Luis de la Patria", Saint Louis of the Motherland, for having contributed important leaders and ideas during the struggle with the United States. During the Reform War, state involvement was very prominent, and during the French Intervention in 1863, the city of San Luis Potosí became the capital of the country under the order of President Benito Juárez.
During the regime of Maximilian, San Luis became an important location. The city was held by the Imperialists until late 1866. In that year the telegraph line was opened between San Luis Potosí and Mexico City, which opened up communication lines and helped begin the industrialization of the state.