No, the potential energy of a spring is indeed [itex]U = \frac{1}{2} k x^2[/itex]. If you want to think of it as work, then know that the spring force is [itex]F = k x[/itex], so the work done is
[tex]W = \int F dx = \int k x dx= \frac{1}{2} k x^2,[/tex]
which is the same answer.