To guide soil fertility investment programmes in sub-Saharan Africa, better understanding is needed of the relative importance of soil and crop management factors in determining smallholder crop yields and yield variability. Spatial variability in crop yields within farms is strongly influenced by variation in both current crop management (e.g. planting dates, fertilizer rates) and soil fertility. Variability in soil fertility is in turn strongly influenced by farmers’ past soil and crop management. The aim of this study was to investigate the relative importance of soil fertility and crop management factors in determining yield variability and the gap between farmers’ maize yields and potential yields in western Kenya. In this study, 522 samples taken from the farms were analysed by diffuse reflectance spectroscopy, using an ASD FieldSpec FR spectroradiometer.