Context. Optimal extraction is a key step in processing the raw images of spectra as registered by two-dimensional detector arrays to a one-dimensional format. Previously reported algorithms reconstruct models for a mean one-dimensional spatial profile to assist a properly weighted extraction. Aims. We outline a simple optimal extraction algorithm (including error propagation), which is very suitable for stabilised, fibre-fed spectrographs and does not model the spatial profile shape. Methods. A high signal-to-noise ratio, master-flat image serves as reference image and is directly used as an extraction profile mask. Each extracted spectral value is the scaling factor relative to the cross-section of the unnormalised master flat that contains all information about the spatial profile, as well as pixel-to-pixel variations, fringing, and blaze. The extracted spectrum is measured relative to the flat spectrum. Results. Using echelle spectra of the HARPS spectrograph we demonstrate a competitive extraction performance in terms of a signal-to-noise ratio and show that extracted spectra can be used for high precision radial velocity measurement. Conclusions. Pre-or post-flat-fielding of the data is not necessary, since all spectrograph inefficiencies inherent to the extraction mask are automatically accounted for. Also the reconstruction of the mean spatial profile by models is not needed, thereby reducing the number of operations to extract spectra. Flat-relative optimal extraction is a simple, efficient, and robust method that can be applied easily to stabilised, fibre-fed spectrographs.