Nonlocal Light-matter Interactions for Spectral Sensing