Remote sensing observations and the direct sampling of material from a few comets have established the characteristic composition of cometary gas. This gas is ionized by solar ultraviolet radiation and the solar wind to form `pick-up' ions, ions in a low ionization state that retain the same compositional signatures as the original gas. The pick-up ions are carried outward by the solar wind, and they could in principle be detected far from the coma. (Sampling of pick-up ions has also been used to study interplanetary dust, Venus' tail and the interstellar medium.) Here we report the serendipitous detection of cometary pick-up ions, most probably associated with the tail of comet Hyakutake, at a distance of 3.4 AU from the nucleus. Previous observations have provided a wealth of physical and chemical information about a small sample of comets, but this detection suggests that remote sampling of comet compositions, and the discovery of otherwise invisible comets, may be possible.