Galectin‐related protein is a kind of lectin without canonical activity that regulates cell adhesion and cell growth. In this study, a novel galectin‐related protein B (OnGRPB) was identified from Nile tilapia (Oreochromis niloticus). The open reading frame of OnGRPB was 438 bp and encoded a peptide of 145 amino acids. The deduced protein sequence of OnGRPB possessed a conserved carbohydrate recognition domain (CRD) with partial sugar binding sites (N‐R, V‐N and W‐E) and shared high identities with other fish GRPB proteins. The qRT‐PCR analysis found that OnGRPB was widely distributed in various tissues and monocyte/macrophages (Mo/MΦ) of healthy tilapia. After Streptococcus agalactiae infection, OnGRPB transcripts were significantly up‐regulated in liver, spleen, head kidney and Mo/MΦ. The recombinant OnGRPB protein (rOnGRPB) had the binding activity and agglutination ability to bacteria. Also, rOnGRPB could modulate antibacterial activity and inflammatory factor expression of Mo/MΦ. These data collectively indicate that OnGRPB plays roles in the immune response of Nile tilapia against bacterial infection.