Spectral methods for partial differential equations with boundary conditions in complex domains are developed with the help of a fictitious domain approach. For rectangular embedding, spectral-Galerkin formulations with special trial and test functions are presented and discussed, as well as the well-posedness and the error analysis. For circular and annular embedding, dimension reduction is applied and a sequence of 1-D problems with artificial boundary values are solved. Applications of our methods include the fractional Laplace problem and the Helmholtz equations. In numerical examples, our methods show good performance on the boundary value problems in both smooth and polygonal complex domains, and the L2 errors decay exponentially for smooth solutions. For singular problems, high-order convergence rates can also be obtained.