Introduction: Mortality from hepatocellular carcinoma associated with viral hepatitis B and C represents a serious public health problem. Hepatocellular carcinoma is the third leading cause of death of neoplastic etiology and the fifth most common malignant tumor in the world. Chronic infection with hepatitis B virus and hepatitis C virus are the main causes of chronic liver disease and hepatocellular carcinoma (HCC). Objectives: describe the deaths due to HCC associated with viral hepatitis B and C in the State of São Paulo and analyze the spatial and temporal distribution of these deaths. Methods: Descriptive ecological study with temporal analysis and spatial distribution of deaths from HCC associated with viral hepatitis B and C in the State of São Paulo, from 2009 to 2017, with data from the Mortality Information System (SIM). Mortality rates for HCC associated with viral hepatitis B and C were calculated. The temporal trend was analyzed by Prais-Winsten regression. Deaths were described according to sociodemographic characteristics and compared using Pearson's chisquare test or Fisher's exact test. The deaths were spatially distributed according to the regional health department. Crude mortality rates and smoothed rates were calculated using the Local Empirical Bayesian method. Results: In the period from 2009 to 2017, 26.3% of deaths from HCC in the state of São Paulo were associated to HBV or HCV. There was a higher proportion of deaths from HCC associated to HCV (22.2%) when compared to HBV (3.9%). The mortality rate due to HCC associated with hepatitis B or C showed a downward trend and a decrease from 0.41 (2009) to 0.33 (2017) deaths per 100,000 inhabitants / year, with an annual decrease of 3.0%. The mortality rate due to HCC associated with hepatitis B also showed a downward trend, ranging from 0.07 (2009) to 0.04 (2017) deaths per 100,000 inhabitants / year, with an annual decrease of 9.1%. However, the HCC mortality rate associated with hepatitis C showed a stationary trend, from 0.34 (2009) to 0.29 (2017) deaths per 100,000 inhabitants / year. Deaths predominated in males and in white individuals. The age group with the highest number of deaths was 50 to 59 years old. Most deaths had 8 to 11 years of study. The spatial distribution revealed a heterogeneous distribution of deaths in the state of São Paulo. Conclusions: The downward trend in mortality rates due to HCC associated with hepatitis B shows an important advance in the control of the disease due to the immunization actions with the Hepatitis B vaccine. However, the mortality rate due to HCC associated with hepatitis C has been keeping stable over the study period, indicating the need for actions and measures to reduce these rates. The spatial distribution of deaths will assist the managers and professionals of the DRS, who will be able to look at this data and raise hypotheses for a deeper knowledge of their regions, based on these results.