To a boundary value problem, we assign an auxiliary problem of determining the spectrum of eigenfunctions and eigenvalues (EFV). After the main problem has been reduced to a form with homogeneous boundary conditions, it becomes possible to prove theorems about the formulas for the solution of the boundary value problem with linear equations of elliptic type for multidimensional multiply connected domains by using the spectral expansion in the Fourier series. We find conditions under which the action of second-order differential operators on the obtained solutions in the Fourier series can be computed not only in the interior of the domain but also on its boundary. But if these conditions are not satisfied, then the series for second-order differential operators do not converge on the boundary. The proposed method for the expansion in the EFV can be used not only in plane but also in spatial problems if the domain of complicated shape can be represented as a combination of bounded domains with known EFV spectra. As one of the examples, we consider the problem of torsion of an elastic rod whose cross-section consists of a rectangle and a half-disk.