Graphical AbstractHighlights d FMT from resistant to susceptible piglets prevents earlyweaning stress-induced diarrhea d Lactobacillus gasseri LA39 and Lactobacillus frumenti confer diarrhea resistance d Diarrhea resistance is mediated by the bacterial secretory circular peptide gassericin A d Gassericin A binding to KRT19 on the membrane of intestinal epithelial cells is essential SUMMARY Alternatives to antibiotics for preventing diarrhea in early-weaned farm animals are sorely needed. CM piglets (a native Chinese breed) are more resistant to early-weaning stress-induced diarrhea than the commercial crossbred LY piglets. Transferring fecal microbiota, but not saline, from healthy CM into LY piglets by oral administration prior to early weaning conferred diarrhea resistance. By comparing the relative abundance of intestinal microbiota in saline and microbiota transferred LY piglets, we identified and validated Lactobacillus gasseri LA39 and Lactobacillus frumenti as two bacterial species that mediate diarrhea resistance. Diarrhea resistance depended on the bacterial secretory circular peptide gassericin A, a bacteriocin. The binding of gassericin A to Keratin 19 (KRT19) on the plasma membrane of intestinal epithelial cells was essential for enhancement of fluid absorption and decreased secretion. These findings suggest the use of L. gasseri LA39 and L. frumenti as antibiotic alternatives for preventing diarrhea in mammals.