For the sustainability of economic, ecological and social development, the safety of infrastructure, including buried pipelines, is extremely important. Undercrossing tunneling can compromise the safety of buried pipelines because of deformations, cracks and dislocations, which can result in wasted resources, environmental pollution and economic losses. Therefore, it is important to assess the pipeline response accurately during tunnel excavation. This paper proposes a generalized Hermite spectral solution to estimate the pipeline response induced by twin tunneling. The proposed solution is formulated by a truncated series of Hermite functions and it is available in an unbounded domain. On the basis of the two-stage analysis method, a general formula for calculating the soil greenfield displacement induced by twin tunneling is first derived using the superposition principle. To obtain the final solution, the soil greenfield displacement and pipeline displacement are expanded using two truncated series of Hermite functions, and the governing differential equation of pipeline displacement is subsequently simplified into a linear algebraic system. After solving this system, a general solution for calculating pipeline displacement is formulated. Then, the convergence of the developed solution is proven, and its validity is verified against existing theoretical solutions and centrifuge test results. The effects of the truncated series number and its scaling factor are investigated. Finally, parametric studies are conducted to discuss pipeline responses induced by twin tunneling.