The topological complexity is a numerical homotopy invariant of a topological space X which is motivated by robotics and is similar in spirit to the classical Lusternik–Schnirelmann category of X. Given a mechanical system with configuration space X, the invariant measures the complexity of motion planning algorithms which can be designed for the system. In this paper, we compute the topological complexity of the configuration space of n distinct ordered points on an orientable surface, for both closed and punctured surfaces. Our main tool is a theorem of B. Totaro describing the cohomology of configuration spaces of algebraic varieties. For configuration spaces of punctured surfaces, this is used in conjunction with techniques from the theory of mixed Hodge structures.