While single photon detectors provide superior intensity sensitivity, spectral resolution is usually lost after the detection event. Yet for applications in low signal infrared spectroscopy recovering information about the photon’s frequency contributions is essential. Here we use highly efficient waveguide integrated superconducting single-photon detectors for on-chip coherent detection. In a single nanophotonic device, we demonstrate both single-photon counting with up to 86% on-chip detection efficiency, as well as heterodyne coherent detection with spectral resolution f/∆f exceeding 1011. By mixing a local oscillator with the single photon signal field, we observe frequency modulation at the intermediate frequency with ultra-low local oscillator power in the femto-Watt range. By optimizing the nanowire geometry and the working parameters of the detection scheme, we reach quantum-limited sensitivity. Our approach enables to realize matrix integrated heterodyne nanophotonic devices in the C-band wavelength range, for classical and quantum optics applications where single-photon counting as well as high spectral resolution are requ ... mehrired simultaneously.