O-linked β-N-acetylglucosamine (O-GlcNAc) is a reversible posttranslational modification found on hundreds of nuclear and cytoplasmic proteins in higher eukaryotes. Despite its ubiquity and essentiality in mammals, functional roles for the O-GlcNAc modification remain poorly defined. Here we develop a combined genetic and chemical approach that enables introduction of the diazirine photocrosslinker onto the O-GlcNAc modification in cells. We engineered mammalian cells to produce diazirine-modified O-GlcNAc by expressing a mutant form of UDP-GlcNAc pyrophosphorylase and subsequently culturing these cells with a cell-permeable, diazirine-modified form of GlcNAc-1-phosphate. Irradiation of cells with UV light activated the crosslinker, resulting in formation of covalent bonds between O-GlcNAc-modified proteins and neighboring molecules, which could be identified by mass spectrometry. We used this method to identify interaction partners for the O-GlcNAc-modified FG-repeat nucleoporins. We observed crosslinking between FG-repeat nucleoporins and nuclear transport factors, suggesting that O-GlcNAc residues are intimately associated with essential recognition events in nuclear transport. Further, we propose that the method reported here could find widespread use in investigating the functional consequences of O-GlcNAcylation.