β-Lactam antibiotics are a class of antibiotics that are commonly used to treat bacterial infections. However, the effects of β-lactam antibiotics on term neonatal intestinal flora have not been fully elucidated. Hospitalized full-term newborns receiving β-lactam antibiotics formed the antibiotic group, while those without antibiotic treatment comprised the non-antibiotic group. A healthy group included healthy full-term newborns. Stool samples were collected for 16S rDNA sequencing to analyze gut microbiota variations. Further investigation was carried out within the β-lactam antibiotic group, exploring the effects of antibiotic use on the newborns’ gut microbiota in relation to the duration and type of antibiotic administration, delivery method, and feeding practices. The antibiotic group exhibited significant difference of microbial beta diversity compared to the other groups. Genera like Klebsiella, Enterococcus,Streptococcus, Alistipes, and Aeromonas were enriched, while Escherichia-Shigella, Clostridium sensu stricto 1, Bifidobacterium, and Parabacteroideswere reduced. Klebsiella negatively correlated with Escherichia-Shigella, positively with Enterobacter, and Escherichia-Shigella negatively correlated with Enterococcus and Streptococcus. Regardless of neonatal age, β-lactam antibiotics induced elevated Klebsiella andEnterococcus. Impact on gut microbiota varied with antibiotic duration and type (cefotaxime or ampicillin/sulbactam). Compared to vaginal delivery, cesarean delivery after β-lactam treatment heightened the abundance of Klebsiella, Enterobacteriaceae_Unclassified, Lactobacillales_Unclassified, and Pectobacterium. Feeding patterns minimally influenced β-lactam-induced alterations. In conclusion, β-lactam antibiotic treatment for neonatal pneumonia and sepsis markedly disrupted intestinal microbiota, favoring Klebsiella, Enterococcus, Streptococcus, Alistipes, and Aeromonas. β-lactam impact varied by duration, type, and delivery method, emphasizing heightened disruptions post-cesarean delivery.