  Let $X$ be a canonically polarized variety, i.e. a complex projective variety
such that its canonical class $K_{X}$ defines an ample $\Q-$line bundle, and
satisfying the conditions $G_1$ and $S_2$. Our main result says that $X$ admits
a K\"ahler-Einstein metric iff $X$ has semi-log canonical singularities i.e.
iff $X$ is a stable variety in the sense of Koll\'ar-Shepherd-Barron and
Alexeev (whose moduli spaces are known to be compact). By definition a
K\"ahler-Einstein metric in this singular context simply means a
K\"ahler-Einstein on the regular locus of $X$ with volume equal to the
algebraic volume of $K_{X},$ i.e. the top intersection number of $K_{X}.$ We
also show that such a metric is uniquely determined and extends to define a
canonical positive current in $c_{1}(K_{X}).$ Combined with recent results of
Odaka our main result shows that $X$ admits a K\"ahler-Einstein metric iff $X$
is K-stable, which thus confirms the Yau-Tian-Donaldson conjecture in this
general setting of (possibly singular) canonically polarized varieties. More
generally, our results are shown to hold in the setting of log minimal
varieties and they also generalize some prior results concerning
K\"ahler-Einstein metrics on quasi-projective varieties.
