We consider a compact perturbation $H_0 = S + K_0^* K_0$ of a self-adjoint operator $S$ with an eigenvalue $lambda^circ$ below its essential spectrum and the corresponding eigenfunction $f$. The perturbation is assumed to be along the eigenfunction $f$, namely $K_0f=0$. The eigenvalue $lambda^circ$ belongs to the spectra of both $H_0$ and $S$. Let $S$ have $sigma$ more eigenvalues below $lambda^circ$ than $H_0$; $sigma$ is known as the spectral shift at $lambda^circ$. We now allow the perturbation to vary in a suitable operator space and study the continuation of the eigenvalue $lambda^circ$ in the spectrum of $H(K)=S + K^* K$. We show that the eigenvalue as a function of $K$ has a critical point at $K=K_0$ and the Morse index of this critical point is the spectral shift $sigma$. A version of this theorem also holds for some non-positive perturbations.