The Masters and the Slaves by Gilberto Freyre — not specifically about São Luís, but an essential work for understanding how Brazilian culture emerged from the intersection of Portuguese, African, and indigenous traditions. Much of what makes Maranhão distinctive — its food, its music, its social structures — traces back to the dynamics Freyre describes.
The Posthumous Memoirs of Brás Cubas by Machado de Assis — Brazil's greatest novelist, and this darkly comic masterpiece is the best introduction to 19th-century Brazilian society, which was the world that made São Luís wealthy. The narrator is dead from the first page, and it only gets better from there.
City of God by Paulo Lins — not set in São Luís but in the Rio favelas of the 1970s and 1980s. Read before or during a Brazil trip as a corrective to the tourist brochure version of the country. The connections between poverty, crime, and race that Lins describes are as relevant to Maranhão as to Rio.