Classification in astrophysics is a fundamental process, especially when it is necessary to understand several aspects of the evolution and distribution of the objects. Over an astronomical image, we need to discern between stars and galaxies and to determine the morphological type for each galaxy. The spectral classification of stars provides important information about stellar physical parameters like temperature and allows us to determine their distance; with this information, it is possible to evaluate other parameters like their physical size and the real 3D distribution of each type of objects. In this work, we present the application of two Artificial Intelligence (AI) techniques for the automatic spectral classification of stellar spectra obtained from the first data release of LAMOST and also to the more recent release (DR5). Two types of Artificial Neural Networks were selected: a feedforward neural network trained according to the Levenberg–Marquardt Optimization Algorithm (LMA) and a Generalized Regression Neural Network (GRNN). During the study, we used four datasets: the first was obtained from the LAMOST first data release and consisted of 50731 spectra with signal-to-noise ratio above 20, the second dataset was obtained from the Indo-US spectral database (1273 spectra), the third one (the STELIB spectral database) was used as an independent test dataset, and the fourth dataset was obtained from LAMOST DR5 and consisted of 17990 stellar spectra with signal-to-noise ratio above 20 also. The results in the first part of the work, when the autoconsistency of the DR1 data was probed, showed some problems in the spectral classification available in LAMOST DR1. In order to accomplish a better classification, we made a two-step process: first the LAMOST and STELIB datasets were classified by the two IA techniques trained with the entire Indo-US dataset. The resulted classification allows us to discriminate at least three groups: the first group contained O and B type stars, whereas the second contained A, F, and G type stars, and finally, the third group contained K and M type stars. The second step consisted of a refinement of the classification, but this time for every group, the most relevant indices were selected. We compared the accuracy reached by the two techniques when they are trained and tested using LAMOST spectra and their published classification and the resultant classifications obtained with the ANNs trained with the Indo-US dataset and applied over the STELIB and LAMOST spectra. Finally, in the first part, we compared the LAMOST DR1 classification with the classification obtained by the application of the NNs GRNNs and LMA trained with the Indo-US dataset. In the second part of the paper, we analyze a set of 17990 stellar spectra from LAMOST DR5 and the very significant improvement in the spectral classification available in DR5 database was verified. For this, we trained ANNs using the k-fold cross-validation technique with k = 5.