Stellar temperature determination for the temperature of its photosphere, the part of the star emitting the electromagnetic radiation (surface temperature), is done (in principle) by treating the spectrum as a black-body spectrum and using Wien's displacement law:
However, only part of any spectrum is observable through the Earth's atmosphere, and in practice, the shape of the observed spectrum is matched with the black-body spectrum of some temperature. Obtaining a relatively full spectrum of the star derives the best such temperature estimate, but requires spectroscopy. A spectral class and/or color indices derived by photometry provide easier-to-obtain approximations, e.g., for obtaining temperatures of large numbers of stars.
Additional accuracy can be obtained through identification of spectral lines and their interrelationships that are produced at certain known temperatures.
Methods to determine temperatures within the interior depend upon theory, specifically models of stellar structure and its associated processes.