The NIR spectra of pharmaceuticals are the result of component contribution and the effects of the different steps of the production process (granulation, compaction, and coating). These effects, even though they are of low magnitude, affect significantly the results of calibration models. Incorporating such effects into the calibration set is essential with a view to constructing a model capable of accurately predicting the contents of production tablets. We developed a new method for incorporating the variability introduced by the production process in the spectra for the calibration set. The method calculates the difference between the spectrum of a tablet and a powder mixture of identical composition prepared in the laboratory; the differences thus calculated for several tablets constitute a set of mathematical vectors that define the overall variability matrix of the process: the process variability matrix. This matrix is added to a set of NIR spectra for several powder mixtures (prepared in laboratory) spanning the desired content range for the active pharmaceutical ingredient (API) in order to obtain the spectral matrix for the calibration set. The API content (in %) of calibration samples is established from weights of their components in the laboratory powder mixtures. The calibration model is constructed by applying the partial least-squares (PLS) algorithm to the spectral matrix of the calibration set. This methodology has been applied successfully on API determination in commercial pharmaceutical tablets. © 2012 The Royal Society of Chemistry.