O-GlcNAc transferase (OGT) is an essential mammalian enzyme that couples metabolic status to the regulation of a wide variety of cellular signaling pathways by acting as a nutrient sensor 1. OGT catalyzes the transfer of N-acetyl-glucosamine from UDP-GlcNAc to serines and threonines of cytoplasmic, nuclear and mitochondrial proteins 2, 3, including numerous transcription factors 4, tumor suppressors, kinases 5, phosphatases 1, and histone-modifying proteins 6. Aberrant O-GlcNAcylation by OGT has been linked to insulin resistance 7, diabetic complications 8, cancer 9 and neurodegenerative diseases including Alzheimer’s 10. Despite the importance of OGT, the details of how it recognizes and glycosylates its protein substrates are largely unknown. We report here two crystal structures of human OGT, as a binary complex with UDP (2.8 A) and a ternary complex with UDP and a peptide substrate (1.95 A). The structures provide clues to the enzyme mechanism, show how OGT recognizes target peptide sequences, and reveal the fold of the unique domain between the two halves of the catalytic region. This information will accelerate the rational design of biological experiments to investigate OGT’s functions and the design of inhibitors for use as cellular probes and to assess its potential as a therapeutic target.