We present numerical simulations of axisymmetric, magnetically driven relativistic jets. Our special-relativistic, ideal-magnetohydrodynamics numerical scheme is specifically designed to optimize accuracy and resolution and to minimize numerical dissipation. In addition, we implement a grid-extension method that reduces the computation time by up to three orders of magnitude and makes it possible to follow the flow up to six decades in spatial scale. To eliminate the dissipative effects induced by a free boundary with an ambient medium we assume that the flow is confined by a rigid wall of a prescribed shape, which we take to be z ~ ra (in cylindrical coordinates, with a ranging from 1 to 3). We also prescribe, through the rotation profile at the inlet boundary, the injected poloidal current distribution: we explore cases where the return current flows either within the volume of the jet or on the outer boundary. The outflows are initially cold, sub-Alfvénic and Poynting flux-dominated, with a total-to-rest-mass energy flux ratio μ ~ 15. We find that in all cases they converge to a steady state characterized by a spatially extended acceleration region. The acceleration process is very efficient: on the outermost scale of the simulation as much as ~ 77 per cent of the Poynting flux has been converted into kinetic energy flux, and the terminal Lorentz factor approaches its maximum possible value (Γ∞ ~= μ). We also find a high collimation efficiency: all our simulated jets (including the limiting case of an unconfined flow) develop a cylindrical core. We argue that this could be the rule for current-carrying outflows that start with a low initial Lorentz factor (Γ0 ~ 1). Our conclusions on the high acceleration and collimation efficiencies are not sensitive to the particular shape of the confining boundary or to the details of the injected current distribution, and they are qualitatively consistent with the semi-analytic self-similar solutions derived by Vlahakis and Königl. We apply our results to the interpretation of relativistic jets in active galactic nuclei: we argue that they naturally account for the spatially extended accelerations inferred in these sources (Γ∞ >~ 10 attained on radial scales R >~ 1017cm) and are consistent with the transition to the matter-dominated regime occurring already at R >~ 1016cm.