We investigated the molecular epidemiology of gentamicin-resistant, extended-spectrum beta-lactamase (ESBL)-producing Klebsiella pneumoniae and Serratia marcescens, and risk factors associated with their acquisition in a neonatal intensive care unit (NICU) of a university hospital in Italy. During the study period (April-November 2004), S. marcescens was responsible for six infections and 31 colonisations, while K. pneumoniae was responsible for six infections and 103 colonisations. Concurrent isolation of both organisms occurred in 24 neonates. Molecular typing identified one major pulsed-field gel electrophoresis pattern each for S. marcescens and K. pneumoniae strains isolated during the study period. An 80 kb plasmid containing bla(SHV-12), bla(TEM-1) and aac(6')-Ib genes, isolated from both S. marcescens and K. pneumoniae strains, and showing identical restriction profiles, transferred resistance to third-generation cephalosporins to a previously susceptible Escherichia coli host. Birthweight, gestational age and use of invasive devices were significantly associated with S. marcescens and K. pneumoniae acquisition on univariate analysis, while empiric antimicrobial treatment with ampicillin and gentamicin, and duration of hospital stay, proved to be the only independent risk factors. In conclusion, conjugal plasmid transfer and empiric antimicrobial therapy with ampicillin and gentamicin might have contributed to the selection and spread of gentamicin-resistant ESBL-producing Enterobacteriaceae in the NICU.