Spectrometry is widely used for the characterization of materials, tissues, and gases, and the need for size and cost scaling is driving the development of mini and microspectrometers. While nanophotonic devices provide narrowband filtering that can be used for spectrometry, their practical application has been hampered by the difficulty of integrating tuning and read-out structures. Here, a nano-opto-electro-mechanical system is presented where the three functionalities of transduction, actuation, and detection are integrated, resulting in a high-resolution spectrometer with a micrometer-scale footprint. The system consists of an electromechanically tunable double-membrane photonic crystal cavity with an integrated quantum dot photodiode. Using this structure, we demonstrate a resonance modulation spectroscopy technique that provides subpicometer wavelength resolution. We show its application in the measurement of narrow gas absorption lines and in the interrogation of fiber Bragg gratings. We also explore its operation as displacement-to-photocurrent transducer, demonstrating optomechanical displacement sensing with integrated photocurrent read-out.