We investigate the relationship between the order parameters of spin models and principal component analysis (PCA). PCA is applied to the spin configurations generated from the Boltzmann distribution for the cases of uniformly interacting and randomly interacting spin models, and the datasets obtained for various specific temperatures are analyzed. In the case of the uniformly interacting spin model, the first principal component is found to be equivalent to the magnetization in the ordered phase, which is the order parameter. For the randomly interacting spin model, we apply the analysis to datasets generated by the Sherrington-Kirkpatrick model. When PCA is performed under the assumption that the Hadamard product of the spin configuration is taken as a new dataset, it is found that the first principal component coincides with the spin-glass order parameter. By analytically treating the limit in which the number of datasets is infinite, it is shown that the first principal component agrees with the order parameter.