Despite considerable interest in temporal and spatial variation of phenotypic selection, very few methods allow quantifying this variation while correctly accounting for the error variance of each individual estimate. Furthermore, the available methods do not estimate the autocorrelation of phenotypic selection, which is a major determinant of eco-evolutionary dynamics in changing environments. We introduce a new method for measuring variable phenotypic selection using random regression. We rely on model selection to assess the support for stabilizing selection, and for a moving optimum that may include a trend plus (possibly autocorrelated) fluctuations. The environmental sensitivity of selection also can be estimated by including an environmental covariate. After testing our method on extensive simulations, we apply it to breeding time in a great tit population in the Netherlands. Our analysis finds support for an optimum that is well predicted by spring temperature, and occurs about 33 days before a peak in food biomass, consistent with what is known from the biology of this species. We also detect autocorrelated fluctuations in the optimum, beyond those caused by temperature and the food peak. Because our approach directly estimates parameters that appear in theoretical models, it should be particularly useful for predicting eco-evolutionary responses to environmental change.