Water-alternating-gas (WAG) injection is a promising technique for sequestering greenhouse gases and enhancing oil recovery. However, the pore-scale mass transport physics, carbon capture, utilization, and storage (CCUS) mechanisms, and optimization of WAG injection under reservoir conditions remain poorly understood. To fill this gap, we, by developing the graphics processing unit (GPU)-accelerated lattice Boltzmann method, conduct pore-scale simulations of WAG injection in a water-wet porous medium. Results reveal that in WAG injection, alternately injected water and gas sweep lower and upper regions of the porous medium, thus improving oil recovery compared to sole water flooding or gas injection. In particular, WAG injection that ends with gas injection exhibits significant potential for both enhanced oil recovery (EOR) and CO2 storage. For a fixed number of injection cycles, increasing individual slug size Iss leads to a higher oil recovery; however, when fixing the total injected volume for different Iss, a lower Iss favors the formation of more isolated clusters, which not only hinders the development of preferential flow paths but also decreases the water-gas density difference in the mixing region, thus increasing sweeping efficiency. The isolated and scattered distribution of CO2 reduces the risk of leakage, which is beneficial to CO2 storage. It is also found that the gravitational segregation effect becomes less pronounced with decreasing gravity, which ultimately leads to a higher oil recovery. In reduced gravity conditions, two typical capillary phenomena, namely, multiple displacement and double capillary trapping, are observed, and when the gravity vanishes, WAG injection leads to almost the same oil recovery as sole water flooding. Moreover, increasing the injection rate results in stronger mixing and interaction between injected gas and water, forming more isolated clusters and thus improving oil recovery.