São Luís is the only city in Brazil that was founded by the French. In 1612 three French ships sailed for Maranhão to try to commandeer a piece of South America. Once established at São Luís the French formed an alliance with the local indigenous population, the Tupinambá, to assail tribes around the mouth of the Amazon in an effort to expand their foothold in the region. But when the inevitable Portuguese attack came in 1614, the French fled within a year.

After a brief Dutch occupation between 1641 and 1644, São Luís developed gradually as a port for exporting sugar, and later cotton. The plantation owners prospered, and by the early 19th century São Luís was one of the wealthiest cities in Brazil, built on the back of the labor of African slaves. Today the city has the third-highest Afro-Brazilian population in the country (after Rio and Salvador).

When demand for São Luís’ crops slackened later in the 19th century, the city went into a long decline, but the economy has been stimulated by several megaprojects in recent decades. In the 1980s a big port complex was constructed at Itaqui, just west of São Luís, to export the mineral riches of the Carajás in neighboring Pará state, and Alcoa built an enormous aluminum-processing plant on the highway south of the city; both constructions remain key to the city's economy today. Thanks to the restoration of many of São Luís’ beautiful old buildings and its proximity to the Lençóis Maranhenses, tourism has also become important.