dTDP-6-deoxy-L-lyxo-4-hexulose reductase (RmlD) catalyzes the final step in the conversion of dTDP-D-glucose to dTDP-L-rhamnose in an NAD(P)H- and Mg2+-dependent reaction. L-rhamnose biosynthesis is an antibacterial target. The structure of RmlD from Salmonella enterica serovar Typhimurium has been determined, and complexes with NADH, NADPH, and dTDP-L-rhamnose are reported. RmlD differs from other short chain dehydrogenases in that it has a novel dimer interface that contains Mg2+. Enzyme catalysis involves hydride transfer from the nicotinamide ring of the cofactor to the C4'-carbonyl group of the substrate. The substrate is activated through protonation by a conserved tyrosine. NAD(P)H is bound in a solvent-exposed cleft, allowing facile replacement. We suggest a novel role for the conserved serine/threonine residue of the catalytic triad of SDR enzymes.