A set of Fourier-like basis functions is constructed for Legendre–Galerkin method for non-periodic boundary value problems and a new space–time spectral method is proposed. A complete error analysis is carried out for a linear parabolic equation and numerical results are presented for several typical linear and nonlinear equations.