Spectral classification is used to differentiate between the different surface temperature of stars. This is determined by measuring the visible hydrogen lines of a star. Originally, the classification was more conventional going from A to O.

Spectral Class A was listed first, as it was believed stronger hydrogen lines meant a stronger surface temperature, down to a Spectral Class O where the hydrogen lines are visibly weaker. When it was found that hydrogen ionizes at higher temperatures causing the hydrogen lines to appear weaker, the classification scale was changed to the modern O,B,A,F,G,K,M,L,T,Y system.

The sun gives off weaker hydrogen lines and many lines of ionized and neutral metals categorizing it as a class G star with a surface temperature of 5,778 K (9,940.73° F.)

More Info: courses.lumenlearning.com