BackgroundThe COVID-19 pandemic has affected the world in multiple ways and has been a challenge for the health systems of each country. From the beginning, risk factors for the severity and mortality of the disease were considered, as the spread of the virus was related to the living conditions of each population.MethodsIn this ecological study we have evaluated the role of geography, precisely the altitude above sea level in the incidence and mortality of COVID-19 in Peru. Incidence and mortality data were taken from the open-access database of the government of Peru until March 2021. COVID-19 cases and COVID-19 mortality were treated as cases/density population and 1000 x cases/inhabitants while altitude was treated as continuous and as a categorical variable divided in 7 categories. The relationship between COVID-19 cases or deaths for COVID-19 and altitude as continuous variable was determined using Spearman correlation test. Meanwhile when altitude was considered as a categorical variable, Poisson regression or negative binomial analyses were applied.ResultsA significant inverse correlation was found between COVID-19 cases by population density and altitude (r=-0.37 p < 0.001). By altitude categories, the lowest risk for infection was observed between 3,000 and 3,500 m (IRR 0.08; 95% CI 0.05,0.12). Moreover, we found an inverse correlation between altitude and COVID-19 mortality (r=-0.39 p < 0.001). Also, the lowest risk for mortality was observed between 3,000 and 3,500 m (IRR 0.12; 95%CI 0.08; 0.18). Similar results were found when analyses were adjusted for inhabitants and stratified by sex.ConclusionThis study reports an inverse relationship between COVID-19 incidence and mortality with respect to the altitude of residence, particularly, a u-shaped protection is shown, with a highest benefit between 3000 and 3500 m. The possibility of using hypoxia as an alternative treatment requires more complex studies that should allow knowing the physiological and environmental mechanisms of the protective role.Supplementary InformationThe online version contains supplementary material available at 10.1186/s12889-023-15537-7.