The most profound effect of disorder on electronic systems is the localization of the electrons transforming an otherwise metallic system into an insulator. If the metal is also a superconductor then, at low temperatures, disorder can induce a pronounced transition from a superconducting into an insulating state. An outstanding question is whether the route to insulating behaviour proceeds through the direct localization of Cooper pairs or, alternatively, by a two-step process in which the Cooper pairing is first destroyed followed by the standard localization of single electrons. Here we address this question by studying the local superconducting gap of a highly disordered amorphous superconductor by means of scanning tunnelling spectroscopy. Our measurements reveal that, in the vicinity of the superconductor-insulator transition, the coherence peaks in the one-particle density of states disappear whereas the superconducting gap remains intact, indicating the presence of localized Cooper pairs. Our results provide the first direct evidence that the superconductor-insulator transition in some homogeneously disordered materials is driven by Cooper-pair localization.