This study aimed to analyse several factors of variation of slurry composition and to establish prediction equations for potential methane (CH 4 ) and ammonia (NH 3 ) emissions. Seventy-nine feed and slurry samples were collected at two seasons (summer and winter) from commercial pig farms sited at two Spanish regions (Centre and Mediterranean). Nursery, growing-fattening, gestating and lactating facilities were sampled. Feed and slurry composition were determined, and potential CH 4 and NH 3 emissions measured at laboratory. Feed nutrient contents were used as covariates in the analysis. Near infrared reflectance spectroscopy (NIRS) was evaluated as a predicting tool for slurry composition and potential gaseous emissions. A wide variability was found both in feed and slurry composition. Mediterranean farms had a higher pH (p<0.001) and ash (p=0.02) concentration than those located at the Centre of Spain. Also, type of farm affected ether extract content of the slurry (p=0.02), with highest values obtained for the youngest animal facilities. Results suggested a buffer effect of dietary fibre on slurry pH and a direct relationship (p<0.05) with fibre constituents of manure. Dietary protein content did not affect slurry nitrogen content but decreased (p=0.003) total and volatile solids concentration. Prediction models of potential NH 3 emissions (R 2 =0.89) and CH 4 yield (R 2 =0.61) were obtained from slurry composition. Predictions from NIRS showed a high accuracy for most slurry constituents (R 2 >0.90) and similar accuracy of prediction of potential NH 3 and CH 4 emissions (R 2 =0.84 and 0.68, respectively) to models using slurry characteristics, which can be of interest to estimate emissions from commercial farms and establish mitigation strategies or optimize biogas production. Additional key words: ammonia; methane; NIRS; animal nutrition; prediction model.