Abstract. Astronomical spectroscopic observations from ground-based telescopes contain background emission lines from the terrestrial atmosphere's airglow. In the near infrared, this background is composed mainly of emission from Meinel bands of hydroxyl (OH), which is produced in highly excited vibrational states by reduction of ozone near 90 km. This emission contains a wealth of information on the chemical and dynamical state of the Earth's atmosphere. However, observation strategies and data reduction processes are usually optimized to minimize the influence of these features on the astronomical spectrum. Here we discuss a measurement technique to optimize the extraction of the OH airglow signal itself from routine J-, H-, and K-band long-slit astronomical spectroscopic observations. As an example, we use data recorded from a point-source observation by the Nordic Optical Telescope's intermediate-resolution spectrograph, which has a spatial resolution of approximately 100 m at the airglow layer. Emission spectra from the OH vibrational manifold from v = 9 down to v = 3, with signal-to-noise ratios up to 280, have been extracted from 10.8 s integrations. Rotational temperatures representative of the background atmospheric temperature near 90 km, the mesosphere and lower thermosphere region, can be fitted to the OH rotational lines with an accuracy of around 0.7 K. Using this measurement and analysis technique, we derive a rotational temperature distribution with v that agrees with atmospheric model conditions and the preponderance of previous work. We discuss the derived rotational temperatures from the different vibrational bands and highlight the potential for both the archived and future observations, which are at unprecedented spatial and temporal resolutions, to contribute toward the resolution of long-standing problems in atmospheric physics.