Objectives: Urinary tract infections (UTIs) caused by multidrug-resistant Escherichia coli have become a major medical concern. Old antibiotics such as fosfomycin have become an alternative therapeutic option due to their effectiveness and, as a result, fosfomycin is now used as a first-line drug for the treatment of UTIs in many countries. Despite low resistance rates, fosfomycin heteroresistance, defined as a phenomenon where subpopulations of bacteria are resistant to high antibiotic concentrations whereas most of the bacteria are susceptible, is an underestimated problem. Methods: The frequency of heteroresistance in E. coli isolated from hospitalized patients in Brazil and its effect on susceptibility of E. coli in biofilms was studied and the isolates were molecularly characterized to reveal the mechanisms behind their fosfomycin heteroresistance using whole-genome sequencing. Results: A higher frequency of fosfomycin heteroresistance compared with other studies was found. In biofilms, most heteroresistant isolates were less sensitive to fosfomycin than control isolates and showed overexpression of metabolic genes thereby increasing their survival rate. Molecular characterization showed that some resistant subpopulations derived from heteroresistant isolates had a defect in their fosfomycin uptake system caused by mutations in transporter and regulatory genes, whereas others overexpressed the murA gene. None to minor effects on bacterial fitness were observed. Oxidative stress protection, virulence and metabolic genes were differentially expressed in resistant subpopulations and heteroresistant isolates. Conclusion: Frequent detection of heteroresistance in UTIs may play a role in the failure of antibiotic treatments and should therefore be more carefully diagnosed.