Identifying effective biological control agents against fungal pathogens and determining their mechanisms of action are important in the control of plant diseases. In this study, we isolated an endophytic bacterial strain, GsB01, from the branches of asymptomatic Gleditsia sinensis. Multi-locus sequence analysis identified the strain as Bacillus velezensis. GsB01 exhibited significant antifungal activity against Thyronectria austroamericana, the causative agent of G. sinensis wilt. Liquid chromatography-mass spectrometry identified four consistently present antimicrobial compounds in GsB01 metabolite fractions with high antifungal activity: macrolactin A, bacillaene A, surfactin, and iturin. GsB01's active metabolite fractions altered the metabolic profiles of T. austroamericana, disrupting seven pathways, including arginine biosynthesis, nucleotide metabolism, purine metabolism, and the pentose phosphate pathway. Furthermore, absolute quantitative polymerase chain reaction analysis suggested that GsB01 may increase the abundance of endophytic bacteria in G. sinensis. The 16S rRNA amplicon sequencing revealed changes in the endophytic landscape in stems and roots following GsB01 introduction, particularly with significant variation in the dominant bacterial genera within the stems. The study highlights GsB01's potential against plant wilt and suggests that its antifungal activity is achieved by secreting antifungal metabolites. The study also recorded changes in the symbiotic microbiota within trees that had been infected with a pathogenic fungus and subsequently treated with an endophytic antagonistic bacterial strain. © 2024 Society of Chemical Industry.