Least-squares spectral analysis