The 'natural' way to prove this is to use Wu's formula for the Stiefel-Whitney classes and basic properties of the Steenrod squares.

In more detail, if $M$ is a closed $n$-manifold (connected, but not necessarily orientable) then by mod 2 Poincaré duality there are unique classes $v_i\in H^i(M;\mathbb{Z}_2$) such that for each $x\in H^{n-i}(X;\mathbb{Z}_2)$
$$\langle Sq^i(x),[M]\rangle = \langle v_i\cup x,[M]\rangle$$
where $[M]\in H_n(M;\mathbb{Z}_2)$ is the mod 2 fundamental class.
The $v_i$ are called the *Wu classes* of $M$ and *Wu's formula* expresses the $k$-th Stiefel-Whitney class as
$$w_k = \sum_{i=0}^k Sq^{k-i}(v_i).$$
For $k=1,2$ this gives
$$w_1=Sq^1(v_0) + Sq^0(v_1)=v_1$$
$$w_2=Sq^2(v_0) + Sq^1(v_1) + Sq^0(v_2) = w_1^2 + v_2$$
after using the basic properties that $Sq^0$ is the identity, that $Sq^i$ is the cup square on $H^i(M;\mathbb{Z}_2)$, and that $Sq^i$ vanishes on $H^k(M;\mathbb{Z}_2)$ for $i>k$.

But the latter property also tells us that $v_i$ must be zero for $i>n-i$, that is, for $i > n/2$. In particular, if $M$ is a surface, then $v_2=0$ so that Wu's formula reduces to $w_2=w_1^2$.

All of this is standard material and the standard reference is Milnor and Stasheff's "Characteristic classes".