Accurately measuring NOx emissions under transient engine conditions is becoming increasingly important with upcoming Euro 7 and EPA 2027 regulations. Traditional physical sensors often struggle with cost and response time, especially with aging of sensors in dynamic operation. This paper introduces a machine-learning–based virtual NOx sensor that can provide real-time emission estimates while reducing reliance on hardware sensors. The approach uses multiple machine-learning methods (Random Forest, Bootstrap Aggregating, Adaptive Boosting, Gradient Boosting, Extreme Gradient Boosting) and selected best one to establish correlations between engine operating parameters, measured steady-state data, and transient duty cycle NOx emissions. Validation across different duty cycles has shown strong alignment with physical sensor readings, with R2 values above 99.95% for training cycle data sets and above 95.34% for held-out cycles during training. The model needs to be trained with larger training samples to further improve accuracy for unseen data sets. By reducing sensor costs, this solution supports scalable use in production engines. The NOx virtual sensor can also serve as a redundancy measure to back up physical sensors, reducing the risk of compliance failures in case of physical sensor faults. Overall, the proposed method offers a cost-effective pathway to improve compliance monitoring, engine performance optimization, and regulatory readiness for the next generation of efficient powertrains.