Panel data, whose series length T is large but whose cross-section size N need not be, are assumed to have a common time trend. The time trend is of unknown form, the model includes additive, unknown, individual-specific components, and we allow for spatial or other cross-sectional dependence and/or heteroscedasticity. A simple smoothed nonparametric trend estimate is shown to be dominated by an estimate which exploits the availability of cross-sectional data. Asymptotically optimal choices of bandwidth are justified for both estimates. Feasible optimal bandwidths, and feasible optimal trend estimates, are asymptotically justified, the finite sample performance of the latter being examined in a Monte Carlo study. A number of potential extensions are discussed.