Planning the defossilization of energy systems by facilitating high penetration of renewables and maintaining access to abundant and affordable primary energy resources is a nontrivial multi-objective problem encompassing economic, technical, environmental, and social aspects. However, so far, most long-term policies to decrease the carbon footprint of our societies consider the cost of the system as the leading indicator in the energy system models. This paper is the first to develop a novel approach by adding the energy return on investment (EROI) in a whole energy system optimization model. We built the database with all EROI technologies and resources considered while keeping the core components of the model: open access, multi-energy carriers, short computational time, and accounting for all the energy sectors. In addition, moving away from fossil-based to carbon-neutral energy systems raises the issue of the uncertainty of low-carbon technologies and resource data. Thus, we conducted a global sensitivity analysis to identify the main parameters driving the variations in the EROI of the system. This novel approach can be applied to any energy system at the worldwide, country, or regional level. We use a real-world case study to illustrate the model: the 2035 Belgian energy system for several greenhouse gas emissions targets.The main results are threefold: (i) the EROI of the system decreases from 8.9 to 3.9 when greenhouse gas emissions are reduced by 5; (ii) the renewable fuels -mainly imported renewable gas -represent the largest share of the system primary energy mix due to the lack of endogenous renewable resources such as wind and solar; (iii) in the sensitivity analysis, the renewable fuels drive 67% of the variation of the EROI of the system for low greenhouse gas emissions scenarios.The decrease in the EROI raises questions about meeting the climate targets without adverse socio-economic impact. Most countries rely massively on fossil fuels, like Belgium, and they could encounter an EROI decline when shifting to carbon neutrality. Therefore, this study demonstrates the importance of considering other criteria, such as the EROI, in energy system models. It helps to nuance the cost-based results to better guide policy-makers in addressing the challenges of the energy transition.