When subjected to fire loading, shallow tunnels may experience loss of stability. This may result in large deformations and ultimately in local collapse of such structures. High temperature has a great negative influence on tunnels, not only because of thermal-induced mechanical degradation of the heated lining but also because of thermal spalling in consequence of the build-up of pore pressure. Thermal spalling causes quick loss of lining sections. Mechanical degradation sole can be simulated by thermo-mechanical models, while consideration of mechanical degradation and spalling requires thermo-hydro-chemo-mechanical (THCM) models and a spalling criterion. After simulation of both processes, the stability of a tunnel structure can be assessed by means of limit analysis. In this work, at first, a fully coupled THCM model is developed. Then, by using a "stress vs strength" criterion and a boundary shifting strategy, the coupled mechanical degradation and thermal spalling processes are captured, providing time-dependent and space-dependent information of the heated lining. Finally, a novel numerical approach, termed discontinuity layout optimization (DLO), is applied to quantify the stability of the tunnel structure with the help of a factor of safety. The proposed numerical procedure is used to conduct numerical studies with, as well as without, consideration of spalling. The results show that spalling has a great impact on the stability of the tunnel. It reduces the thickness of the lining section and accelerates the heating process of the inner concrete.