The energy of a Kähler class, on a compact complex manifold (M,J) of Kähler type, is the infimum of the squared L2-norm of the scalar curvature over all Kähler metrics representing the class. We study general properties of this functional, and define its gradient flow over all Kähler classes represented by metrics of fixed volume. When besides the trivial holomorphic vector field of (M,J), all others have no zeroes, we extend it to a flow over all cohomology classes of fixed top cup product. We prove that the dynamical system in this space defined by the said flow does not have periodic orbits, that its only fixed points are critical classes of a suitably defined extension of the energy function, and that along solution curves in the Kähler cone the energy is a monotone function. If the Kähler cone is forward invariant under the flow, solutions to the flow equation converge to a critical point of the class energy function. We show that this is always the case when the manifold has a signed first Chern class. We characterize the forward stability of the Kähler cone in terms of the value of a suitable time dependent form over irreducible subvarieties of (M,J). We use this result to draw several geometric conclusions, including the determination of optimal dimension dependent bounds for the squared L2-norm of the scalar curvature functional.