Leptospirosis is an epidemic disease caused by bacteria of theLeptospiragenus. Its risk is closely associated with inadequate sanitation and flooding, a common public health challenge in large urban centers together with urban environmental modifications, and socio-economic factors. This retrospective observational research investigated the association between three contextual factors (drainage, soil impermeability and social vulnerability) and the distribution of leptospirosis cases in Campinas city, São Paulo, Brazil. We hypothesized that the number of cases will increase in areas that are impermeable and in proximity to drainage systems (rivers and canals) as well as where social vulnerability is high. We investigated the links between infection and the environment based on 54 autochthonous cases that reported having had contact with flood water or mud. Spatial statistics were used to map disease distribution and investigate the relationship between leptospirosis cases and contextual factors. Our results indicate that leptospirosis occurs in areas of greater social vulnerability, near drainage systems and in the most waterproofed urban areas, with the highest risk at 200 m from drainage systems. This study demonstrated that leptospirosis risk remains highly determined by living and working conditions. These findings support targeted strategies to deliver effective prevention, treatment and control interventions in highly populated urban areas of the Global South. Furthermore, combining local contextual environmental information with spatial analysis produces meaningful data in terms of guiding health public policy and spatial planning and provides more precise parameters for future epidemiological models and prevention actions.Author summaryThis study explores the links between environmental and contextual factors that influence the post-flood risk of leptospirosis transmission to humans in Campinas, São Paulo, Brazil. Leptospirosis is an infectious disease caused by theLeptospirabacteria. We investigated how drainage systems, impermeable soil area, and social vulnerability contribute to disease distribution, using spatial statistics to map spatial conditions for 54 cases linked to flood water exposure. Our findings highlight how environmental and socio-economic factors intersect to influence public health, shedding light on the role of urban planning and drainage infrastructure in the transmission risk of infectious diseases. This interdisciplinary approach underscores the importance of considering social and environmental contexts when developing public health strategies, aligning with broader global efforts to address diseases linked to urbanization and environmental changes. Our study advances the understanding of how spatial data and environmental factors can guide more precise parameters for epidemiological models, offering insights into disease control interventions. We discuss the role of prevention, flood management, and equitable infrastructure in safeguarding public health, emphasizing how the environment shapes health risks. This research provides practical recommendations for helping decision-makers prioritize areas for intervention to reduce the burden of leptospirosis, particularly in vulnerable communities.