Aspergillus fungi can produce a wide range of secondary metabolites, and they have represented a potential resource of novel bioactive compounds. Bacterial plant diseases have a serious impact on the sustainable development of agriculture worldwide, so it is necessary to use natural antibacterial compounds in microorganisms to control plant pathogens. This study was conducted to investigate the bioactive compounds of Aspergillus niger xj, three plant pathogens (Agrobacterium tumefaciens T-37, Erwinia carotovora EC-1, and Ralstonia solanacearum RS-2) were used as indicator bacteria, according to the biological activity tracking, five compounds were isolated from A. niger xj spore powder, and characterization of compounds was done by NMR (1H-NMR and 13C-NMR) and EI-MS and was identified as ergosterol (1), β-sitosterol (2), 5-pentadecylresorcinol (3), 5-hydroxymethyl-2-furancarboxylic acid (4), and succinimide (5). Compounds 3 and 5 were isolated from A. niger xj for the first time. The minimum inhibitory concentration (MIC) of five compounds against three plant pathogens was evaluated, the results showed that compound 4 exhibited the strongest antibacterial activity against tested bacteria, and RS-2 was the most sensitive to compound 4, showing the lowest MIC of 15.56 μg/ml. We concluded that the mechanism of action of the compound 4 against RS-2 might be described as compound 4 acting on bacterial protein synthesis and intracellular metabolism according to the results of the scanning electron microscopy observation, permeability of cell membrane and SDS-PAGE. These results indicated that compound 4 has good potential to be as a biocontrol agent. In conclusion, the results from this study demonstrated that the compounds with antibacterial activity are of great significance of the prevention and control of plant phytopathogenic bacteria, and they may be applicable to exploring alternative approaches to integrated control of phytopathogens.