Abstract With an emphasis on improving energy efficiency (EE) and lowering power consumption of rapidly growing connected vehicles and infrastructures, Vehicle-to-Everything (V2X) communication is emerging as a fundamental element in the development of smart cities. This paper introduces an innovative reinforcement learning (RL)-based method for dynamic resource allocation within 5G-enabled V2X networks, focusing on EE and minimizing power consumption. The suggested framework adeptly modifies transmission power, and spectrum allocation in real-time, responding to fluctuating traffic patterns and network demands. By facilitating ongoing learning and decision-making, the RL system guarantees optimal resource utilization while preserving high-quality service and low-latency communication. Q-learning is employed to dynamically regulate power levels in urban vehicular scenarios, taking Doppler shift, user mobility, and changing traffic conditions into account. Experimental evaluations demonstrate a substantial decrease in power consumption and an improvement in network efficiency providing a sustainable solution for smart mobility initiatives, promoting the advancement of greener, more reliable, and energy-efficient urban transportation systems. Data availability The datasets used and/or analyzed during the current study available from the corresponding author on reasonable request. References Xiao, H., Zhu, D. & Chronopoulos, A. T. IEEE Trans. Intell. Transp. Syst. 21(12), 4947–4958 (2020). Lim, D.-W., Chun, C.-J. & Kang, J.-M. Transmit power adaptation for D2D communications underlaying SWIPT-based IoT cellular networks. IEEE Internet Things J. 10(2), 987–999 (2023). Akhter, J., Hazra, R., Mihovska, A. & Prasad, R. A Novel resource sharing scheme for vehicular communication in 5G cellular networks for smart cities. IEEE Trans. Consum. Electron. 70(3), 5848–5856 (2024). Liang, Y. J., Tseng, Y. C. & Hsieh, C. W. A deep reinforcement learning-based D2D spectrum allocation underlaying a cellular network. Wireless Netw. 31(1), 435–441 (2025). Pan, Z. & Yang, J. Deep reinforcement learning-based optimization method for D2D communication energy efficiency in heterogeneous cellular networks. IEEE Access 12, 140439–140455 (2024). Huynh,