Using the fact that $f(1) = 1$, it follows that $f(n) = n$ for any integer $n$, and so $f(\frac{n}{m}) = \frac{n}{m}$ for any rational $\frac{n}{m}$.
Now show that $f$ preserves the ordering on the reals:
If $a \geq 0$, then
$$f(a) = f(\sqrt{a}^2) = f(\sqrt{a})^2 \geq 0$$
It follows that if $a < b$, $f(a) < f(b)$.
Finally, choose $r \in \mathbb{R}$ and let $q_i$ be a sequence of rational numbers with
$$q_1 < q_2 < ...$$
and $q_i \to r$ as $i \to \infty$. Use the above point about orderings to show that
$$q_i = f(q_i) < f(r)$$
for every $i$, so that
$$r = \limsup_{i \to \infty} q_i \leq f(r)$$
Do something similar with decreasing sequences to get the reverse inequality.
The reverse direction of the proof should be immediately clear.