We do three things. First, we characterize the class of measures in P_2(M) such that for any other measure in P_2(M) there exists a unique optimal transport plan, and this plan is induced by a map. Second, we study the tangent space at any measure and we identify the class of measures for which the tangent space is an Hilbert space. Third, we prove that these two classes of measures coincide. This answers a question recently raised by Villani. Our results concerning the tangent space can be extended to the case of Alexandrov spaces