To determine the risk factors of extubation failure and its effect on the prognosis of patients who had successfully passed a spontaneous breathing trial (SBT). The clinical data of patients with mechanical ventilation more than 24 hours who passed SBT admitted to department of intensive care unit (ICU) of First Hospital of Qinhuangdao from November 2018 to November 2019 were retrospectively analyzed. According to the outcome of weaning within 48 hours after weaning, patients were divided into weaning success group and weaning failure group. The baseline data, the presence of basic cardiopulmonary diseases, B-type natriuretic peptide (BNP), fluid balance, albumin and hemoglobin within 24 hours before weaning, the time of mechanical ventilation before weaning, rapid shallow breathing index (RSBI) during SBT, oxygenation index, cough peak flow at the end of SBT, and prognostic indicators were collected. The outcome of weaning was taken as the dependent variable, and the observation factors were taken as the independent variable for univariate analysis. The factors with statistical significance in univariate analysis were analyzed by binary Logistic regression to determine the influencing factors of weaning failure. Of the 204 patients, 167 (81.9%) were successfully weaned, and 37 (18.1%) failed. Compared with the weaning success group, the total duration of mechanical ventilation and the length of ICU stay in the weaning failure group were significantly longer [days: 13.0 (7.5, 23.5) vs. 5.0 (3.0, 8.0), 17.0 (12.5, 31.0) vs. 10.0 (6.0, 15.0), both P < 0.01], and the tracheotomy rate and mortality were significantly higher (32.4% vs. 0%, 51.4% vs. 0%, both P < 0.01). Univariate analysis showed that there were significant differences in age, proportion of patients with cardiopulmonary diseases, BNP and cough peak flow between weaning failure group and weaning success group [age (years old): 70.65±15.78 vs. 62.69±15.82, cardiopulmonary diseases: 62.2% vs. 24.6%, BNP (ng/L): 416.87 (32.70, 1 225.80) vs. 45.36 (10.00, 273.60), cough peak flow (L/min): 59.89±9.06 vs. 83.84±16.52, all P < 0.01]. However, there were no significant differences in gender, acute physiology and chronic health evaluation II (APACHE II) at admission, mechanical ventilation time before weaning, albumin, hemoglobin, oxygenation index, RSBI and fluid balance 24 hours before weaning between weaning failure group and weaning success group [male: 51.4% vs. 68.3%, APACHE II: 16.70±6.65 vs. 15.67±6.28, mechanical ventilation time before weaning (days): 6.0 (2.5, 11.0) vs. 5.0 (3.0, 8.0), albumin (g/L): 27.78±4.15 vs. 27.76±4.46, hemoglobin (g/L): 102.43±15.80 vs. 100.61±17.19, oxygenation index (mmHg, 1 mmHg = 0.133 kPa): 359.33±79.83 vs. 365.75±78.23, RSBI (times×L-1×min-1): 50.73±24.97 vs. 46.76±15.53, positive fluid balance: 70.3% vs. 69.5%, all P > 0.05]. The results of binary Logistic regression analysis showed that age ≥ 75 years old [odds ratio (OR) = 3.099, 95% confidence interval (95%CI) was 1.003-9.574, P = 0.049], presence of cardiopulmonary diseases (OR = 3.599, 95%CI was 1.126-11.498, P = 0.031), BNP within 24 hours before weaning (OR = 1.002, 95%CI was 1.000-1.003, P = 0.005) were the risk factors of extubation failure, while cough peak flow at the end of SBT was the protective factor (OR = 0.869, 95%CI was 0.823-0.917, P = 0.000). For patients who had successfully passed SBT, age ≥ 75 years old, the presence of cardiopulmonary diseases and an increased level of BNP within 24 hours were the risk factors of extubation failure. In addition, the higher the cough peak flow at the end of SBT, the lower the risk of weaning failure will be.