The abundance of interstellar molecular nitrogen (N2) is of considerable importance: models of steady-state gas-phase interstellar chemistry1,2, together with millimetre-wavelength observations3,4of interstellar N2H+in dense molecular clouds predict that N2should be the most abundant nitrogen-bearing molecule in the interstellar medium. Previous attempts to detect N2absorption in the far-ultraviolet5or infrared6(ice features) have hitherto been unsuccessful. Here we report the detection of interstellar N2at far-ultraviolet wavelengths towards the moderately reddened star HD 124314 in the constellation of Centaurus. The N2column density is larger than expected from models of diffuse clouds and significantly smaller than expected for dense molecular clouds1. Moreover, the N2abundance does not explain the observed variations7in the abundance of atomic nitrogen (N I) towards high-column-density sightlines, implying that the models of nitrogen chemistry in the interstellar medium are incomplete8.