BackgroundInternal migrants pose a critical threat to eliminating Tuberculosis (TB) in many high-burden countries. Understanding the influential pattern of the internal migrant population in the incidence of tuberculosis is crucial for controlling and preventing the disease. We used epidemiological and spatial data to analyze the spatial distribution of tuberculosis and identify potential risk factors for spatial heterogeneity.MethodsWe conducted a population-based, retrospective study and identified all incident bacterially-positive TB cases between January 1st, 2009, and December 31st, 2016, in Shanghai, China. We used Getis-OrdGi*statistics and spatial relative risk methods to explore spatial heterogeneity and identify regions with spatial clusters of TB cases, and then used logistic regression method to estimate individual-level risk factors for notified migrant TB and spatial clusters. A hierarchical Bayesian spatial model was used to identify the attributable location-specific factors.ResultsOverall, 27,383 bacterially-positive tuberculosis patients were notified for analysis, with 42.54% (11,649) of them being migrants. The age-adjusted notification rate of TB among migrants was much higher than among residents. Migrants (aOR, 1.85; 95%CI, 1.65-2.08) and active screening (aOR, 3.13; 95%CI, 2.60-3.77) contributed significantly to the formation of TB high-spatial clusters. With the hierarchical Bayesian modeling, the presence of industrial parks (RR, 1.420; 95%CI, 1.023-1.974) and migrants (RR, 1.121; 95%CI, 1.007-1.247) were the risk factors for increased TB disease at the county level.ConclusionWe identified a significant spatial heterogeneity of tuberculosis in Shanghai, one of the typical megacities with massive migration. Internal migrants play an essential role in the disease burden and the spatial heterogeneity of TB in urban settings. Optimized disease control and prevention strategies, including targeted interventions based on the current epidemiological heterogeneity, warrant further evaluation to fuel the TB eradication process in urban China.