A numerical method designed to solve the time-dependent, three-dimensional, incompressible Navier-Stokes equations in boundary layers is presented. The fluid domain is the half-space over a flat plate, and periodic conditions are applied in the horizontal directions. The discretization is spectral. The basis functions are divergence-free and a weak formulation of the momentum equation is used, which eliminates the pressure term. An exponential mapping and Jacobi polynomials are used in the semi-infinite direction, with the irrotational component receiving special treatment. Issues related to the accuracy, stability and efficiency of the method are discussed. Very fast convergence is demonstrated on some model problems with smooth solutions. The method has also been shown to accurately resolve the fine scales of transitional and turbulent boundary layers.