In this paper a method to determine spatially-resolved profiles of the electron temperature T e and density n e in an electron-cyclotron-resonance (ECR) discharge is presented. This technique is based on the observation of line emission from a neutral Li atom beam, which is injected into the plasma and excited by electron collisions. A collisional-radiative model valid for the injected Li atoms is used to predict the emission intensities as function of n e and T e for several lines theoretically. In contrast to the electron temperature regime representative for the edge of tokamak discharges (T e > 5 eV), the ECR discharge offers a T e range where selected line intensity ratios strongly depend on the electron temperature. Therefore, a comparison of the measured ratios with the calculated ones yields T e profiles for the first time. The n e measurement is performed as in tokamaks by observing the attenuation of the beam due to ionization in the plasma. We present radial profiles of T e and n e for discharges in argon and xenon under different operating conditions. These results are compared with results obtained by Thomson scattering. Our measurements give evidence for a satisfying agreement between the two methods.