High mobility group protein B2 (HMGB2) is an abundant chromatin-associated protein with pivotal roles in transcription, cell proliferation, differentiation, inflammation, and tumorigenesis. However, its immune function in Nile tilapia (Oreochromis niloticus) remains unclear. In this study, we identified a homologue of HMGB2 from Nile tilapia (On-HMGB2) and investigated its functions in the immune response against streptococcus infection. The open reading frame (ORF) of On-HMGB2 spans 642 bp, encoding 213 amino acids, and contains two conserved HMG domains. On-HMGB2 shares over 80 % homology with other fish species and 74%–76 % homology with mammals. On-HMGB2 was widely distributed in various tissues, with its highest transcript levels in the liver and the lowest in the intestine. Knockdown of On-HMGB2 promoted the inflammatory response in Nile tilapia, increased the bacterial load in the tissues, and led to elevated mortality in Nile tilapia following Streptococcus agalactiae infection. Taken together, On-HMGB2 significantly influences the immune system of Nile tilapia in response to streptococcus infection.