Endophytes are colonizers of healthy plants and they normally exhibit biocontrol activities, such as reducing the occurrence of plant diseases and promoting plant growth. The endophytic bacterium Bacillus halotolerans Q2H2 (Q2H2) was isolated from the roots of potato plants and was found to have an antagonistic effect on pathogenic fungi. Q2H2 was identified by morphological observations, physiological and biochemical identification, and 16S rRNA gene sequence analysis. Genes related to the anti-fungal and growth-promoting effects were analyzed using whole-genome sequencing and comparative genomic analysis. Finally, we analyzed the growth-promoting and biocontrol activities of Q2H2 in potato plants using pot experiments. Antagonism and non-volatile substance plate tests showed that Q2H2 had strong antagonism against Fusarium oxysporum, Fusarium commune, Fusarium graminearum, Fusarium brachygibbosum, Rhizoctonia solani and Stemphylium solani. The plate test showed that Q2H2 had the ability to produce proteases, cellulases, β-1,3-glucanase, dissolved organic phosphate, siderophores, indole-3-acetic acid (IAA), ammonia and fix nitrogen. The suitable growth ranges of Q2H2 under different forms of abiotic stress were pH 5-9, a temperature of 15-30°C, and a salt concentration of 1-5%. Though whole-genome sequencing, we obtained sequencing data of approximately 4.16 MB encompassed 4,102 coding sequences. We predicted 10 secondary metabolite gene clusters related to antagonism and growth promotion, including five known products surfactin, bacillaene, fengycin, bacilysin, bacillibactin, and subtilosin A. Average nucleotide identity and comparative genomic analyses revealed that Q2H2 was Bacillus halotolerans. Through gene function annotation, we analyzed genes related to antagonism and plant growth promotion in the Q2H2 genome. These included genes involved in phosphate metabolism (pstB, pstA, pstC, and pstS), nitrogen fixation (nifS, nifU, salA, and sufU), ammonia production (gudB, rocG, nasD, and nasE), siderophore production (fhuC, fhuG, fhuB, and fhuD), IAA production (trpABFCDE), biofilm formation (tasA, bslA, and bslB), and volatile compound production (alsD, ilvABCDEHKY, metH, and ispE), and genes encoding hydrolases (eglS, amyE, gmuD, ganB, sleL, and ydhD). The potato pot test showed that Q2H2 had an obvious growth-promoting effect on potato roots and better control of Fusarium wilt than carbendazim. These findings suggest that the strain-specific genes identified in bacterial endophytes may reveal important antagonistic and plant growth-promoting mechanisms.