Introduction: Mental and physical state of mothers during pregnancy affects the development of fetus. This study aimed to investigate the role of neonates’ gender in pain responses and its association with maternal stress during pregnancy and programming. Materials and Methods: This study was conducted on 105 neonates (53 females and 52 males) born in hospitals of Gorgan, Northern Iran. The pain stimulus was intramuscular injection of vitamin K, a routine procedure performed for infants at birth. The first injection was done for all subjects under the same conditions. The neonatal infant pain scale was used for assessment of pain intensity in newborns. Maternal stress during pregnancy was assessed by measuring hair cortisol levels. Data analysis was done using Kolmogorov-Smirnov test, independent t-test and Pearson correlation coefficient. Results: There was no significant difference in the mean pain intensity score before, during and after the injection between male and female newborns. During the injection, the mean pain score of male neonates whose mothers had higher cortisol levels was significantly higher than male neonates whose mothers had normal cortisol levels (P-value=0.01). However, there was no significant relationship between cortisol level and pain intensity score of newborns. Conclusions: Our results show that the mean pain score during the injection is significantly higher in male neonates whose mothers have higher cortisol levels. There is no significant relationship between cortisol level and pain intensity score of newborn