Assessing pain in newborns in the NICU is crucial due to their frequent exposure to painful stimuli, yet it's challenging due to the subjective nature of current methods. This study aimed to evaluate the effectiveness of an AI system designed for automatic facial recognition by comparing its performance with the expert opinion of health care provider. This is a secondary analysis from an eye-tracking study, assessing neonatal pain evaluations by healthcare professionals. The performance of AI software, FaceReader 9, was compared to experts' evaluations using a visual-analog scale, focusing on identifying specific facial action units associated with different pain levels. The study found significant differences in AI-generated metrics-arousal and valence-across three stimulus types: non-noxious thermal, short-noxious, and prolonged-noxious, with p-values below 0.001. A strong correlation (r = 0.84, p ≤ .001) was observed between AI metrics and expert ratings. Eleven facial action units were identified as relevant to describe neonatal pain. The findings highlight the AI system's potential in accurately detecting and analyzing newborn facial expressions in response to varying pain intensities, demonstrating a significant correlation with healthcare professionals' assessments. This suggests that AI technology could enhance objective pain assessment in neonates.