The global shift to sustainable energy, driven by climate concerns and energy security, is backed by worldwide governmental commitments to reduce greenhouse gas emissions and enhance renewable energy sources in the energy systems. In 2016, the Portuguese Government pledged to carbon neutrality by 2050 as part of this global effort. This article proposes technical solutions for reducing carbon dioxide emissions and increasing renewable energy in the Portuguese mainland energy system by 2050, considering the targets set by the government. An energy system modelling approach based on the Grey Wolf Optimiser and the EnergyPLAN software was introduced. Seven scenarios for 2050 assess the impacts of transport electrification and hydrogen grid integration while minimising costs and/or carbon dioxide emissions. The results show that achieving a nearly 100% renewable electricity system and carbon neutrality is possible, considering a carbon capture ranging from 2.65Mt to 5.87Mt. The 2050 energy system requires a minimum battery storage of 5.1GWh and a minimum natural gas storage of 2,063GWh. Transport electrification requires an increase in the total installed capacity by at least 1.83GW, while hydrogen integration increases it by a minimum of 8.25GW. Developing interconnection capacity beyond 15% of the total installed capacity is crucial for grid stability and reducing fossil fuel dependence.