We give a necessary and sufficient condition on the cost function so that the map solution of Monge's optimal transportation problem is continuous for arbitrary smooth positive data. This condition was first introduced by Ma, Trudinger and Wang ,  for a priori estimates of the corresponding Monge-Ampère equation. It is expressed by a socalled cost-sectional curvature being non-negative. We show that when the cost function is the squared distance of a Riemannian manifold, the cost-sectional curvature yields the sectional curvature. As a consequence, if the manifold does not have non-negative sectional curvature everywhere, the optimal transport map cannot be continuous for arbitrary smooth positive data. The non-negativity of the cost-sectional curvature is shown to be equivalent to the connectedness of the contact set between any cost-convex function (the proper generalization of a convex function) and any of its supporting functions. When the cost-sectional curvature is uniformly positive, we obtain that optimal maps are continuous or Hölder continuous under quite weak assumptions on the data, compared to what is needed in the Euclidean case. This case includes the quadratic cost on the round sphere.