Inflammation is a central mechanism in metabolic disorders associated with morbidity and mortality and dietary factors can modulate inflammation. We aimed to prospectively investigate the association between an empirically developed, food-based dietary inflammatory pattern (EDIP) score and the risk of overall and cause-specific mortality, using data from the US National Health and Nutrition Examination Survey from 1999 to 2014. EDIP score was derived by entering thirty-nine predefined commonly consumed food groups into the reduced rank regression models followed by stepwise linear regression, which was most predictive of two plasma inflammation biomarkers including C-reactive protein and leucocyte count among 25 500 US adults. This score was further validated in a testing set of 9466 adults. Deaths from baseline until 31 December 2015 were identified through record linkage to the National Death Index. During a median follow-up of 7·8 years among 40 074 participants, we documented 4904 deaths. Compared with participants in the lowest quintile of EDIP score, those in the highest quintile had a higher risk of overall death (hazard ratio (HR) = 1·19, 95 % CI 1·08, 1·32, Ptrend = 0·002), and deaths from cancer (HR = 1·41, 95 % CI 1·14, 1·74, Ptrend = 0·017) and CVD (HR = 1·22, 95 % CI 0·98, 1·53, Ptrend = 0·211). When stratified by age, the association of EDIP with overall mortality was stronger among individuals under 65 years of age (Pinteraction = 0·001). Diets with a higher inflammatory potential were associated with increased risk of overall and cancer-specific mortality. Interventions to reduce the adverse effect of pro-inflammatory diets may potentially promote health and longevity.