Absorption spectroscopy is widely used in sensing and astronomy to understand molecular compositions on microscopic to cosmological scales. However, typical dispersive spectroscopic techniques require multichannel detection, fundamentally limiting the ability to detect extremely weak signals when compared to direct photometric methods. We report the realization of direct spectral molecular detection using a silicon nanophotonic waveguide resonator, obviating dispersive spectral acquisition. We use a thermally tunable silicon ring resonator with a transmission spectrum matched and cross-correlated to the quasi-periodic vibronic absorption lines of hydrogen cyanide. We show that the correlation peak amplitude is proportional to the number of overlapping ring resonances and gas lines, and that molecular specificity is obtained from the phase of the correlation signal in a single detection channel. Our results demonstrate on-chip correlation spectroscopy that is less restricted by the signal-to-noise penalty of other spectroscopic approaches, enabling the detection of faint spectral signatures.