This paper is devoted to the analysis of metric measure spaces satisfying locally the curvature-dimension condition CD(K,N) introduced by the second author and also studied by Lott & Villani. We prove that the local version of CD(K,N) is equivalent to a global condition CD∗(K,N), slightly weaker than the (usual, global) curvature-dimension condition. This so-called reduced curvature-dimension condition CD∗(K,N) has the local-to-global property. We also prove the tensorization property for CD∗(K,N). As an application we conclude that the fundamental group π1(M,x0) of a metric measure space (M,d,m) is finite whenever it satisfies locally the curvature-dimension condition CD(K,N) with positive K and finite N.