Preterm birth, bacterial colonization, and formula feeding predispose to necrotizing enterocolitis (NEC). Antibiotics are commonly administered to prevent sepsis in preterm infants, but it is not known whether this affects intestinal immunity and NEC resistance. We hypothesized that broad-spectrum antibiotic treatment improves NEC resistance and intestinal structure, function, and immunity in neonates. Caesarean-delivered preterm pigs were fed 3 days of parenteral nutrition followed by 2 days of enteral formula. Immediately after birth, they were assigned to receive either antibiotics (oral and parenteral doses of gentamycin, ampicillin, and metronidazole, ANTI, n ϭ 11) or saline in the control group (CON, n ϭ 13), given twice daily. NEC lesions and intestinal structure, function, microbiology, and immunity markers were recorded. None of the ANTI but 85% of the CON pigs developed NEC lesions by day 5 (0/11 vs. 11/13, P Ͻ 0.05). ANTI pigs had higher intestinal villi (ϩ60%), digestive enzyme activities (ϩ53-73%), and goblet cell densities (ϩ110%) and lower myeloperoxidase (Ϫ51%) and colonic microbial density (10 5 vs. 10 10 colony-forming units, all P Ͻ 0.05). Microarray transcriptomics showed strong downregulation of genes related to inflammation and innate immune response to microbiota and marked upregulation of genes related to amino acid metabolism, in particular threonine, glucose transport systems, and cell cycle in 5-day-old ANTI pigs. In a follow-up experiment, 5 days of antibiotics prevented NEC at least until day 10. Neonatal prophylactic antibiotics effectively reduced gut bacterial load, prevented NEC, intestinal atrophy, dysfunction, and inflammation and enhanced expression of genes related to gut metabolism and immunity in preterm pigs.