We present a solution to the long-standing problem of automatically classifying stellar spectra of all temperature and luminosity classes with the accuracy shown by expert human classifiers. We use the 15 Å resolution near-infrared spectral classification system described by Torres-Dodgen & Weaver in 1993. Using the spectrum with no manual intervention except wavelength registration, artificial neural networks (ANNs) can classify these spectra with Morgan-Keenan types with an accuracy comparable to that obtained by human experts using 2 Å resolution blue spectra, which is about 0.5 types (subclasses) in temperature and about 0.25 classes in luminosity. Accurate temperature classification requires a hierarchy of ANNs, while luminosity classification is most successful with a single ANN. We propose an architecture for a fully automatic classification system.