Cool stars such as our Sun are surrounded by a million degree hot outer atmosphere, the corona. For more than 60 years, the physical nature of the processes heating the corona to temperatures well in excess of those on the stellar surface have remained puzzling. Recent progress in observational techniques and numerical modeling now opens a new window to approach this problem. We present the first coronal emission-line spectra synthesized from three-dimensional numerical models describing the evolution of the dynamics and energetics as well as of the magnetic field in the corona. In these models the corona is heated through motions on the stellar surface that lead to a braiding of magnetic field lines inducing currents that are finally dissipated. These forward models enable us to synthesize observed properties such as (average) emission-line Doppler shifts or emission measures in the outer atmosphere, which until now have not been understood theoretically, even though many suggestions have been made in the past. As our model passes these observational tests, we conclude that the flux braiding mechanism is a prime candidate for being the dominant heating process of the magnetically closed corona of the Sun and solar-like stars.