BACKGROUND: Although leprosy is recognised as a disease of poverty, there is little evidence on the specific socioeconomic factors associated with disease risk. To inform targeted strategies for disease elimination, we investigated socioeconomic markers of leprosy risk in Brazil. METHODS: Socioeconomic data from the 100 Million Brazilian Cohort were linked to the Brazilian national disease registry (Sistema de Informação de Agravos de Notificação) for leprosy from Jan 1, 2007, to Dec 31, 2014. Using Poisson regression, we assessed the association of socioeconomic factors with risk of incident leprosy in the full cohort and in children (aged 0-15 years), by leprosy subtype and region of residence. FINDINGS: In an analysis of 23 899 942 individuals including 18 518 patients with leprosy, increased levels of deprivation were associated with an increased risk of leprosy in Brazil. Directions of effect were consistent in children younger than 15 years and across disease subtypes. Individuals residing in regions with the highest poverty in the country (central-west, north, and northeast regions) had a risk of leprosy incidence five-to-eight times greater than did other individuals. Decreased levels of income and education and factors reflecting unfavourable living conditions were associated with an up to two-times increase in leprosy incidence (incidence rate ratio 1·46, 95% CI 1·32-1·62, for lowest vs highest quartile of income per capita; 2·09, 95% CI 1·62-2·72, for lowest vs highest level of education). INTERPRETATION: Within the poorest half of the Brazilian population, the most deprived individuals have the greatest risk of leprosy. Strategies focusing on early detection and treatment in the poorest populations could contribute substantially to global disease control. FUNDING: Medical Research Council, Wellcome Trust, Coordenação de Aperfeiçoamento de Pessoal de Nível Superior (Brazil), the Conselho Nacional das Fundações Estaduais de Amparo à Pesquisa, Economic and Social Research Council, Biotechnology and Biological Sciences Research Council, Conselho Nacional de Desenvolvimento Científico e Tecnológico, and Fundação de Apoio à Pesquisa do Distrito Federal