Volatile organic compounds (VOCs) produced by bacteria play an important, yet relatively unexplored role in interactions between plants and phytopathogens. In this study, the soil bacterium Bacillus halotolerans NYG5 was identified as a potent biocontrol agent against several phytopathogenic fungi (Macrophomina phaseolina, Rhizoctonia solani, Pythium aphanidermatum, and Sclerotinia sclerotiorum) through the production of VOCs. NYG5-emitted VOCs also inhibited the growth of bacterial pathogens (Agrobacterium tumefaciens, Xanthomonas campestris, Clavibacter michiganensis, and Pseudomonas syringae). When cultured in various growth media, NYG5 produced a variety of VOCs. Five distinct VOCs (2-methylbutanoic acid, 5-methyl-2-hexanone, 2,3-hexanedione, 2-ethyl-1-hexanol, and 6-methyl-2-heptanone) were identified using headspace GC-MS. 2,3-Hexanedione exhibited potent lethal effects on the tested phytopathogens and nematicidal activity against Meloidogyne javanica at a concentration of 50 ppm. In addition, 0.05 ppm 2,3-hexanedione stimulated the expression of pathogenesis-related genes 1 and 2 in Arabidopsis thaliana. Interestingly, 2,3-hexanedione is used as a food additive at higher concentrations than those tested in this study. Hence, 2,3-hexanedione is a promising biologically active compound that might serve as a sustainable alternative to common chemical pesticides and an elicitor of plant defense.