To investigate the relationship between covid-19 hospital mortality and risk factors, innovating by considering contextual and individual factors and spatial dependency and using data from the city of São Paulo, Brazil. The study was performed with a spatial hierarchical retrospective cohort design using secondary data (individuals and contextual data) from hospitalized patients and their geographic unit residences. The study period corresponded to the first year of the pandemic, from February 25, 2020 to February 24, 2021. Mortality was modeled with the Bayesian context, Bernoulli probability distribution, and the integrated nested Laplace approximations. The demographic, distal, medial, and proximal covariates were considered. We found that per capita income, a contextual covariate, was a protective factor (odds ratio: 0.76 [95% credible interval: 0.74-0.78]). After adjusting for income, the other adjustments revealed no differences in spatial dependence. Without income inequality in São Paulo, the spatial risk of death would be close to one in the city. Other factors associated with high covid-19 hospital mortality were male sex, advanced age, comorbidities, ventilation, treatment in public healthcare settings, and experiencing the first covid-19 symptoms between January 24 and February 24, 2021. Other than sex and age differences, geographic income inequality was the main factor responsible for the spatial differences in the risk of covid-19 hospital mortality. Investing in public policies to reduce socioeconomic inequities, infection prevention, and other intersectoral measures should focus on lower per capita income, to control covid-19 hospital mortality.