Streptococcus agalactiae (Group B Streptococcus, GBS) is an opportunistic pathogen causing urinary tract infection (UTI). Endolysin EN572-5 was identified in prophage KMB-572-E of the human isolate Streptococcus agalactiae KMB-572. The entire EN572-5 gene was cloned into an expression vector and the corresponding recombinant protein EN572-5 was expressed in Escherichia coli in a soluble form, isolated by affinity chromatography, and characterized. The isolated protein was highly active after 30 min incubation in a temperature range of − 20 °C to 37 °C and in a pH range of 5.5–8.0. The endolysin EN572-5 lytic activity was tested on different Streptococcus spp. and Lactobacillus spp. The enzyme lysed clinical GBS (n = 31/31) and different streptococci (n = 6/8), and also exhibited moderate lytic activity against UPEC (n = 4/4), but no lysis of beneficial vaginal lactobacilli (n = 4) was observed. The ability of EN572-5 to eliminate GBS during UTI was investigated using an in vitro model of UPSA. After the administration of 3 μM EN572-5, a nearly 3-log decrease of urine bacterial burden was detected within 3 h. To date, no studies have been published on the use of endolysins against S. agalactiae during UTI.Key points• A lytic protein, EN572-5, from a prophage of a human GBS isolate has been identified.• This protein is easily produced, simple to prepare, and stable after lyophilization.• The bacteriolytic activity of EN572-5 was demonstrated for the first time in human urine.Graphical abstract