Post-translational modification of protein serines/threonines with N-acetylglucosamine (O-GlcNAc) is dynamic, inducible and abundant, regulating many cellular processes by interfering with protein phosphorylation. O-GlcNAcylation is regulated by O-GlcNAc transferase (OGT) and O-GlcNAcase, both encoded by single, essential, genes in metazoan genomes. It is not understood how OGT recognises its sugar nucleotide donor and performs O-GlcNAc transfer onto proteins/peptides, and how the enzyme recognises specific cellular protein substrates. Here, we show, by X-ray crystallography and mutagenesis, that OGT adopts the (metal-independent) GT-B fold and binds a UDP-GlcNAc analogue at the bottom of a highly conserved putative peptide-binding groove, covered by a mobile loop. Strikingly, the tetratricopeptide repeats (TPRs) tightly interact with the active site to form a continuous 120 Å putative interaction surface, whereas the previously predicted phosphatidylinositide-binding site locates to the opposite end of the catalytic domain. On the basis of the structure, we identify truncation/point mutants of the TPRs that have differential effects on activity towards proteins/peptides, giving first insights into how OGT may recognise its substrates.