Streptococcus agalactiae is a common agent of clinical and subclinical bovine mastitis and an important cause of human infections, mainly among pregnant women, neonates and nonpregnant adults with underlying diseases. The present study describes the genetic and phenotypic diversity among 392 S. agalactiae human and bovine strains isolated between 1980 and 2006 in Brazil. The most prevalent serotypes were Ia, II, III and V and all the strains were susceptible to penicillin, vancomycin and levofloxacin. Resistance to clindamycin, chloramphenicol, erythromycin, rifampicin and tetracycline was observed. Among the erythromycin resistant strains, mefA/E, ermA and, mainly, ermB gene were detected, and a shift of prevalence from the macrolide resistance phenotype to the macrolide-lincosamide-streptogramin B resistance phenotype over the years was observed. The 23 macrolide-resistant strains showed 19 different pulsed-field gel electrophoresis profiles. Regarding macrolide resistance, a major concern in S. agalactiae epidemiology, the present study describes an increase in erythromycin resistance from the 80s to the 90s followed by a decrease in the 2000-2006 period. Also, the genetic heterogeneity described points out that erythromycin resistance in Brazil is rather due to horizontal gene transmission than to spreading of specific macrolide-resistant clones. © 2013 Elsevier Editora Ltda.