The dopamine-containing projection from the ventral tegmental area of the midbrain to the nucleus accumbens is critically involved in mediating the reinforcing properties of cocaine. Although neurons in this area respond to rewards on a subsecond timescale, neurochemical studies have only addressed the role of dopamine in drug addiction by examining changes in the tonic (minute-to-minute) levels of extracellular dopamine. To investigate the role of phasic (subsecond) dopamine signalling, we measured dopamine every 100 ms in the nucleus accumbens using electrochemical technology. Rapid changes in extracellular dopamine concentration were observed at key aspects of drug-taking behaviour in rats. Before lever presses for cocaine, there was an increase in dopamine that coincided with the initiation of drug-seeking behaviours. Notably, these behaviours could be reproduced by electrically evoking dopamine release on this timescale. After lever presses, there were further increases in dopamine concentration at the concurrent presentation of cocaine-related cues. These cues alone also elicited similar, rapid dopamine signalling, but only in animals where they had previously been paired to cocaine delivery. These findings reveal an unprecedented role for dopamine in the regulation of drug taking in real time.