DISTANT comets are sometimes observed to undergo outbursts of activity that generate a surrounding coma, but the cause of this activity is not known1,2. Whereas such outbursts in near-Sun comets are driven by the sublimation of water ice3, distant comets are too cold for this process to operate. The most plausible mechanisms involve the release of trapped gases from ice heated by an exothermic phase transition from an amorphous to a crystalline state4-6, or the sublimation of very volatile ices such as molecular nitrogen and carbon monoxide7-9. Here we report the detection of emission from carbon monoxide at submillimetre wavelengths from a distant comet, the periodic comet Schwassmann-Wachmann 1. The inferred rate of CO production is sufficient to generate the observed coma. These results provide the first direct evidence that sublimation of volatiles can drive the activity of distant comets.