Ca(2+)/calmodulin-dependent protein kinase II (CaMKII) is an enzyme with important regulatory functions in the heart and brain, and its chronic activation can be pathological. CaMKII activation is seen in heart failure, and can directly induce pathological changes in ion channels, Ca(2+) handling and gene transcription. Here, in human, rat and mouse, we identify a novel mechanism linking CaMKII and hyperglycaemic signalling in diabetes mellitus, which is a key risk factor for heart and neurodegenerative diseases. Acute hyperglycaemia causes covalent modification of CaMKII by O-linked N-acetylglucosamine (O-GlcNAc). O-GlcNAc modification of CaMKII at Ser 279 activates CaMKII autonomously, creating molecular memory even after Ca(2+) concentration declines. O-GlcNAc-modified CaMKII is increased in the heart and brain of diabetic humans and rats. In cardiomyocytes, increased glucose concentration significantly enhances CaMKII-dependent activation of spontaneous sarcoplasmic reticulum Ca(2+) release events that can contribute to cardiac mechanical dysfunction and arrhythmias. These effects were prevented by pharmacological inhibition of O-GlcNAc signalling or genetic ablation of CaMKIIδ. In intact perfused hearts, arrhythmias were aggravated by increased glucose concentration through O-GlcNAc- and CaMKII-dependent pathways. In diabetic animals, acute blockade of O-GlcNAc inhibited arrhythmogenesis. Thus, O-GlcNAc modification of CaMKII is a novel signalling event in pathways that may contribute critically to cardiac and neuronal pathophysiology in diabetes and other diseases.