Objectives: This study investigates the association between the treatment with heparin and mortality in patients admitted with Covid-19. Methods: Routinely recorded, clinical data, up to the 24th of April 2020, from the 2075 patients with Covid-19, admitted in 17 hospitals in Spain between the 1st of March and the 20th of April 2020 were used. The following variables were extracted for this study: age, gender, temperature, and saturation of oxygen on admission, treatment with heparin, hydroxychloroquine, azithromycin, steroids, tocilizumab, a combination of lopinavir with ritonavir, and oseltamivir, together with data on mortality. Multivariable logistic regression models were used to investigate the associations. Results: At the time of collecting the data, 301 patients had died, 1447 had been discharged home from the hospitals, 201 were still admitted, and 126 had been transferred to hospitals not included in the study. Median follow up time was 8 (IQR:5-12) days. Heparin had been used in 1734 patients. Heparin was associated with lower mortality when the model was adjusted for age and gender, with OR (95%CI): 0.55 (0.37-0.82) p=0.003. This association remained significant when saturation of oxygen <90%, and temperature >37C were added to de model with OR: 0.54(0.36-0.82) p=0.003, and also when all the other drugs were included as covariates OR: 0.42 (0.26-0.66) p<0.001. Conclusions: The association between heparin and lower mortality observed in this study can be acknowledged by clinicians in hospitals and in the community. Randomized controlled trials to assess the causal effects of heparin in different therapeutic regimes are required.