Penicillium digitatum is the main fungi causing postharvest decay of citrus fruits. In this study, the strain h217 was identified as Bacillus altitudins and it showed strong biocontrol activity against P. digitatum in citrus. In vitro tests, B. altitudins h217 can effectively inhibit the growth of P. digitatum and form an inhibitory region with a diameter of 52.79 mm in PDA plate. It can also effectively delay the occurrence of P. digitatum, and reduce the incidence rate and the severity of P. digitatum in vivo. In addition, B. altitudins h217 could produce volatile organic compound (VOCs), and its VOCs have an inhibitory rate of 76.83% against P. digitatum. Three possible antifungal substances (5-methyl-2-hexanone, methoxy-phenyl oxime and 2-pentylfuran) were identified through gas chromatography-mass spectrometry (GC-MS). Acetophenone oxime (alternative compounds of methoxy-phenyl oxime) was selected for antifungal tests in vitro and in vivo, which confirmed its antifungal activity. Fluorescence staining experiments showed that B. altitudins h217 can severely damage the cell membrane of P. digitatum and cause an explosion of intracellular reactive oxygen species (ROS). In addition, B. altitudins h217 can significantly reduce the activity of peroxidase (POD) in P. digitatum. These results indicated that B. altitudins h217 has great potential in controlling postharvest diseases of citrus, and its VOCs can also provide new ideas for the development of postharvest fumigants for citrus. This study may provide a new biocontrol agent for controlling P. digitatum in citrus and deepen understanding of the biocontrol mechanism of B. altitudins h217.