Nursing homes (NHs) have been implicated as significant reservoirs of antibiotic-resistant organisms causing severe infectious disease. We investigated the prevalence and molecular epidemiology of, and risk factors for, faecal carriage of extended-spectrum β-lactamase-producing Enterobacteriaceae (ESBL-E). A multicentre cross-sectional study was conducted in seven NHs in Shanghai between March 2014 and May 2014. Antimicrobial susceptibility testing and polymerase chain reaction were used to detect genes coding for ESBLs and carbapenemases. NH records at individual-resident level and facility level were examined for potential risk factors. Four hundred and fifty-seven Enterobacteriaceae isolates were collected of which 183 (46·92%) were colonized by ESBL-E. CTX-M enzymes (198/200, 99%) predominated, with CTX-M-14 (84/200, 42%) the most common types. Two carbapenemase producers harboured blaKPC-2. Resistance rates to carbapenems, TZP, AK, FOS, CL and TGC were low. History of invasive procedures [odds ratio (OR) 2·384, 95% confidence interval (CI) 1·318–4·310, P = 0·004], narrow-spectrum cephalosporins (OR 1·635, 95% CI 1·045–2·558, P = 0·031) and broad-spectrum cephalosporins (OR 3·276, 95% CI 1·278–8·398, P = 0·014) were independently associated with ESBL-E carriage. In conclusion, NH residents have a very high prevalence of faecal carriage of ESBL-E. Continuous and active surveillance is important, as are prudent infection control measures and antibiotic use to prevent and control the spread of these antibiotic-resistant strains.