Not all plant-based and animal foods exert the same health effects due to their various nutrient compositions. We aimed to assess the quality of plant-based v. animal foods in relation to mortality in a prospective cohort study. Using data collected from a nationally representative sample of 36 825 adults in the National Health and Nutrition Examination Survey 1999–2014, we developed a de novo Comprehensive Diet Quality Index (cDQI) that assesses the quality of seventeen foods based on the healthfulness and separately scored the quality of eleven plant-based foods in a plant-based Diet Quality Index (pDQI) and six animal foods in an animal-based Diet Quality Index (aDQI). Mortality from all causes, heart disease and cancer were obtained from linkage to the National Death Index up to 31 December 2015. Cox proportional hazard models were used to estimate hazard ratios (HR) and 95 % CI after multivariable adjustments. During a median follow-up of 8·3 years, 4669 all-cause deaths occurred, including 798 deaths due to heart disease and 1021 due to cancer. Compared with individuals in the lowest quartile, those in the highest quartile of cDQI had a lower risk of all-cause mortality (HR 0·75, 95 % CI 0·65, 0·86; Ptrend < 0·001), which largely reflected the inverse relationship between quality of plant-based foods (pDQI) and all-cause mortality (HR 0·66, 95 % CI 0·58, 0·74; Ptrend < 0·001). No independent association was found for the quality of animal foods (aDQI) and mortality. Our results suggest that consuming healthy plant-based foods is associated with lower all-cause mortality among US adults.