In this article, we prove that if a finitely presented group has an asymptotic cone which is tree-graded with respect to a precise set of pieces then it is relatively hyperbolic. This answers a question of Mark Sapir and generalizes a result of Kapovich and Kleiner to relatively hyperbolic groups.