Background Stricturing and penetrating complications account for substantial morbidity and health-care costs in paediatric and adult onset Crohn's disease. Validated models to predict risk for complications are not available, and the effect of treatment on risk is unknown. Methods We did a prospective inception cohort study of paediatric patients with newly diagnosed Crohn's disease at 28 sites in the USA and Canada. Genotypes, antimicrobial serologies, ileal gene expression, and ileal, rectal, and faecal microbiota were assessed. A competing-risk model for disease complications was derived and validated in independent groups. Propensity-score matching tested the effect of anti-tumour necrosis factor α (TNFα) therapy exposure within 90 days of diagnosis on complication risk. Findings Between Nov 1, 2008, and June 30, 2012, we enrolled 913 patients, 78 (9%) of whom experienced Crohn's disease complications. The validated competing-risk model included age, race, disease location, and antimicrobial serologies and provided a sensitivity of 66% (95% CI 51–82) and specificity of 63% (55–71), with a negative predictive value of 95% (94–97). Patients who received early anti-TNFα therapy were less likely to have penetrating complications (hazard ratio [HR] 0·30, 95% CI 0·10–0·89; p=0·0296) but not stricturing complication (1·13, 0·51–2·51; 0·76) than were those who did not receive early anti-TNFα therapy. Ruminococcus was implicated in stricturing complications and Veillonella in penetrating complications. Ileal genes controlling extracellular matrix production were upregulated at diagnosis, and this gene signature was associated with stricturing in the risk model (HR 1·70, 95% CI 1·12–2·57; p=0·0120). When this gene signature was included, the model's specificity improved to 71%. Interpretation Our findings support the usefulness of risk stratification of paediatric patients with Crohn's disease at diagnosis, and selection of anti-TNFα therapy. Funding Crohn's and Colitis Foundation of America, Cincinnati Children's Hospital Research Foundation Digestive Health Center.