This study aimed to analyse the diversity and taxonomic composition of the nasopharyngeal microbiota, to determine its association with COVID-19 clinical outcome. To study the microbiota, we utilized 16S rRNA sequencing of 177 samples that came from a retrospective cohort of COVID-19 hospitalized patients. Raw sequences were processed by QIIME2. The associations between microbiota, invasive mechanical ventilation (IMV), and all-cause mortality were analysed by multiple logistic regression, adjusted for age, gender, and comorbidity. The microbiota α diversity indexes were lower in patients with a fatal outcome, whereas the β diversity analysis showed a significant clustering in these patients. After multivariate adjustment, the presence of Selenomonas spp., Filifactor spp., Actinobacillus spp., or Chroococcidiopsis spp., was associated with a reduction of more than 90% of IMV. Higher diversity and the presence of certain genera in the nasopharyngeal microbiota seem to be early biomarkers of a favourable clinical evolution in hospitalized COVID-19 patients.