Predicting survival in very preterm infants is critical in clinical medicine and parent counseling. In this prospective cohort study involving 96 very preterm infants, we evaluated whether the metabolomic analysis of gastric fluid and urine samples obtained shortly after birth could predict survival in the first 3 and 15 days of life (DOL), as well as overall survival up to hospital discharge. Gas chromatography–mass spectrometry (GC-MS) profiling was used. Uni- and multivariate statistical analyses were conducted to evaluate significant metabolites and their prognostic value. Differences in several metabolites were identified between survivors and non-survivors at the time points of the study. Binary logistic regression showed that certain metabolites in gastric fluid, including arabitol, and succinic, erythronic and threonic acids, were associated with 15 DOL and overall survival. Gastric glyceric acid was also associated with 15 DOL survival. Urine glyceric acid could predict survival in the first 3 DOL and overall survival. In conclusion, non-surviving preterm infants exhibited a different metabolic profile compared with survivors, demonstrating significant discrimination with the use of GC-MS-based gastric fluid and urine analyses. The results of this study support the usefulness of metabolomics in developing survival biomarkers in very preterm infants.