(1) The normalized Ricci flow (NRF) on compact surfaces always exists for all time and does not have singularities. Moreover, NRF fixes the conformal class of the metric.

(2) Let $r$ be the integral of the curvature, which is constant under any flow. Hamilton and Osgood-Phillips-Sarnak (independently, I think) showed that if $r\leq 0$, then the NRF converges to a metric of constant curvature. Hamilton also proved that if the curvature is positive everywhere, then NRF converges to a metric of constant curvature. This part of the argument unfortunately assumes the uniformization theorem.

(3) Chow showed that if $r>0$, then eventually the curvature will become positive everywhere and then Hamilton's argument applies.

(4) Much later, Chen, Lu, and Tian wrote a 2 page paper explaining how to remove the uniformization theorem from Hamilton's argument. http://arxiv.org/abs/math/0505163

(5) Putting it all together, Ricci flow gives an new proof of uniformization, i.e. every metric on a compact surface is conformal to a metric of constant curvature. Since the only constant curvature metrics are quotients of the standard sphere, Euclidean space, and hyperbolic space, one can then deduce the classification of surfaces.

As mentioned by Spiro, this whole story, except for (4), is told in the book by Chow and Knopf.

Note: A lot of this information is already in comments by others, but not in answer form. I'm writing this mainly because the accepted answer does not seem complete to me.

notan expert, but as far as I know you never need surgery in dimension 2. If you start with a compact (probably oriented, as well) 2-manifold, the Ricci flow always has long-time existence and convergence to a constant curvature metric. This does indeed give (I believe) the classification of compact oriented surfaces. – Spiro Karigiannis Dec 2 '10 at 2:36