The force for a spring with displacement \vec{x}, spring constant k is \vec{F}(x)=-k\vec{x} (Hook's Law).
From Newton's law \vec{F}=m \vec{a}=m \frac{d^2 x}{dt^2}
So m \frac{d^2x}{dt^2}=-k x.
The solution of the above equation is x=A \sin\omega t.
Since \frac{dx}{dt}= A \omega \cos\omega t, \frac{d^2x}{dt^2}= -A \omega^2 \sin\omega t=-\omega^2 x
So \omega=\sqrt{\frac{k}{m}}.
If the spring is moved away equilibrium position, it will move with displacement similar to x=A \sin\omega t, which is called simple Harmonic motion (SHM).

The following applet shows relation betweeb simple harmonic motion and spring motion.

\frac{x^2}{a^2}+\frac{y^2}{b^2}=1, x(t)=a*\sin(\omega t), y(t)=b*\cos(\omega t)

The above clip is actually adopted from "The mechanical universe" series.