The aim of this study was to determine the epidemiology and risk factors associated with community-onset urinary tract infections (CO-UTIs) due to extended-spectrum β-lactamase-producing Klebsiella pneumoniae (ESBL-Kp). A cohort study including all consecutive patients with K. pneumoniae CO-UTI identified from January 2010 to December 2014 was conducted. Patients with CO-UTI due to ESBL-Kp were then included as cases in a retrospective case-control-control study; controls were outpatients with CO-UTI caused by non-ESBL-producing Escherichia coli and K. pneumoniae (non-ESBL-Ec and non-ESBL-Kp, respectively). Each control was matched in a 2:1 ratio according to patient age, sex and year of isolation. Genotyping confirming ESBL was performed by multiplex PCR and sequencing. The prevalence of ESBL-Kp CO-UTIs, calculated among all K. pneumoniae CO-UTIs, increased from 2.4% in 2010 to 10.3% in 2014 (P = 0.01). Among cases, 63.8% were truly community-acquired, and CTX-M-15 was the predominant β-lactamase enzyme type (79.3%). A total of 83 cases and 319 controls were studied. Being a nursing home resident [odds ratio (OR) = 8.8, 95% confidence interval (CI) 2.6-29.4] and previous cephalosporin use (OR = 4.01, 95% CI 1.8-9.2) were risk factors independently associated with CO-UTI due to ESBL-Kp. In conclusion, the prevalence of CO-UTIs due to ESBL-Kp is increasing. In most cases, ESBL-Kp CO-UTIs are community-acquired and produce CTX-M-15 β-lactamase. Exposure to cephalosporins and being a nursing home resident were risk factors associated with ESBL-Kp CO-UTIs. CTX-M-15-producing K. pneumoniae isolates are emerging in the community.