When analyzing panel data using regression models, it is often reasonable to allow for time-varying covariate effects. We propose a novel approach to modelling timevarying coefficients in panel data regressions, which is based on penalized regression techniques. To illustrate the usefulness of this approach, we revisit the well-known empirical puzzle of the ‘death of distance’ in international trade. We find significant differences between results obtained with the proposed estimator and those obtained with ‘traditional’ methods. The proposed method can also be used for model selection, and to allow covariate effects to vary over other dimensions than time.