We present spatially resolved X-ray spectra taken with the EPIC cameras of XMM-Newton of a sample of 17 cooling clusters and three non-cooling clusters for comparison. The deprojected spectra are analyzed with a multi-temperature model, independent of any a priori assumptions about the physics behind the cooling and heating mechanisms. All cooling clusters show a central decrement of the average temperature, most of them of a factor of ~2. At each radius within the cooling region the gas is non-isothermal. The differential emission measure distribution peaks near the maximum (ambient) temperature, and steeply declines towards lower temperatures, proportional to T^3, or alternatively a cut-off at about a quarter to half of the maximum temperature. In general, we find a poor correlation between radio flux of the central galaxy and the temperature decrement of the cooling flow. This is interpreted as evidence that except for a few cases heating by a central AGN is not the most common cause of weak cooling flows. We investigate the role of heat conduction by electrons and find that the theoretically predicted conductivity rates are not high enough to balance radiation losses. The differential emission measure distribution has remarkable similarities with the predictions from coronal magnetic loop models. Also the physical processes involved (radiative cooling, thermal conduction along the loops, gravity) are similar for clusters loops and coronal loops. If coronal loop models apply to clusters, we find that a few hundred loops per scale height should be present. The typical loop sizes deduced from the observed emission measure distribution are consistent with the characteristic magnetic field sizes deduced from Faraday rotation measurements.