Background: Combating viral hepatitis is part of the UN Sustainable Development Goals (SDGs), and WHO has put forth hepatitis B elimination targets in its Global Health Sector Strategy on Viral Hepatitis (WHO-GHSS) and Interim Guidance for Country Validation of Viral Hepatitis Elimination (WHO Interim Guidance). We estimated the global, regional, and national prevalence of hepatitis B virus (HBV), as well as mortality and disability-adjusted life-years (DALYs) due to HBV, as part of the Global Burden of Diseases, Injuries, and Risk Factors Study (GBD) 2019. This included estimates for 194 WHO member states, for which we compared our estimates to WHO elimination targets. Methods: The primary data sources were population-based serosurveys, claims and hospital discharges, cancer registries, vital registration systems, and published case series. We estimated chronic HBV infection and the burden of HBV-related diseases, defined as an aggregate of cirrhosis due to hepatitis B, liver cancer due to hepatitis B, and acute hepatitis B. We used DisMod-MR 2.1, a Bayesian mixed-effects meta-regression tool, to estimate the prevalence of chronic HBV infection, cirrhosis, and aetiological proportions of cirrhosis. We used mortality-to-incidence ratios modelled with spatiotemporal Gaussian process regression to estimate the incidence of liver cancer. We used the Cause of Death Ensemble modelling (CODEm) model, a tool that selects models and covariates on the basis of out-of-sample performance, to estimate mortality due to cirrhosis, liver cancer, and acute hepatitis B. Findings: In 2019, the estimated global, all-age prevalence of chronic HBV infection was 4·1% (95% uncertainty interval [UI] 3·7 to 4·5), corresponding to 316 million (284 to 351) infected people. There was a 31·3% (29·0 to 33·9) decline in all-age prevalence between 1990 and 2019, with a more marked decline of 76·8% (76·2 to 77·5) in prevalence in children younger than 5 years. HBV-related diseases resulted in 555 000 global deaths (487 000 to 630 000) in 2019. The number of HBV-related deaths increased between 1990 and 2019 (by 5·9% [–5·6 to 19·2]) and between 2015 and 2019 (by 2·9% [–5·9 to 11·3]). By contrast, all-age and age-standardised death rates due to HBV-related diseases decreased during these periods. We compared estimates for 2019 in 194 WHO locations to WHO-GHSS 2020 targets, and found that four countries achieved a 10% reduction in deaths, 15 countries achieved a 30% reduction in new cases, and 147 countries achieved a 1% prevalence in children younger than 5 years. As of 2019, 68 of 194 countries had already achieved the 2030 target proposed in WHO Interim Guidance of an all-age HBV-related death rate of four per 100 000. Interpretation: The prevalence of chronic HBV infection declined over time, particularly in children younger than 5 years, since the introduction of hepatitis B vaccination. HBV-related death rates also decreased, but HBV-related death counts increased as a result of population growth, ageing, and cohort effects. By 2019, many countries had met the interim seroprevalence target for children younger than 5 years, but few countries had met the WHO-GHSS interim targets for deaths and new cases. Progress according to all indicators must be accelerated to meet 2030 targets, and there are marked disparities in burden and progress across the world. HBV interventions, such as vaccination, testing, and treatment, must be strategically supported and scaled up to achieve elimination. Funding: Bill & Melinda Gates Foundation.