We aimed to analyze the spatial distribution of gestational syphilis from 2008 to 2018 in Brazil and identify correlations with socioeconomic and health-care aspects. This ecological study used municipalities of Brazil as the unit of analysis. Data collection took place between June and July 2021. Data were extracted for 2008 to 2018, and information on the epidemic in animals in the country was obtained from data records. The gestational syphilis detection rate was the dependent variable, and the independent variables were the Municipal Human Development Index, the proportion of doctors per inhabitant in primary health care (PHC), and the percentage of PHC coverage. The data went through an aggregation process in 482 immediate regions of urban articulation. The global Moran’s I index and the local spatial correlation indicator detected territorial clusters using GeoDa software. The gestational syphilis detection rate was distributed unevenly in the immediate regions of urban articulation between 2008 and 2018, and presented a negative spatial correlation with the Municipal Human Development Index (Moran’s I = −0.243, P ≤ 0.05), the percentage of PHC coverage (Moran’s I = −0.163, P ≤ 0.05), and the proportion of doctors per inhabitants in PHC (Moran’s I = −0.164, P ≤ 0.05). Socioeconomic inequalities, mainly related to the availability of human resources and access to health services, are correlated with the spatial distribution of gestational syphilis in Brazil. Investments in social policies and strengthening of PHC are essential for controlling gestational syphilis.