Which piece of spectral data is necessary to determine the spectral class of a star?

Luminosity
Absolute magnitude
Temperature
Apparent magnitude

The temperature of the star is necessary to determine its spectral class.

The spectral class of a star can be determined primarily by its temperature.