There is lack of information on couple's sexual relation during pregnancy and also the lack of a national written training protocol in this regard in Iran. State authorities want to develop and implement such a protocol. Therefore, this study aimed to determine the effectiveness of a sex education package on the sexual function of pregnant women. 88 women in their 8 to 14 weeks of pregnancy were randomly allocated into two groups of intervention and control. In the intervention group a midwife carried out sex education in two 60 minutes lecture sessions and group discussions for the participants. Moreover, educational booklets were distributed at the end of the first session and couple's questions were answered by telephone. In the control group women were taught nutritional education with the same procedure. Sexual function was evaluated using the female sexual function index (FSFI) before and four weeks after the education. Paired t-test, student's t-test and chi square were used to analyze the data. There were no significant differences among the groups in terms of their baseline characteristics, including mean sexual function scores before the education. After the education the mean of the total score of sexual function was significantly higher in the intervention group compared with the control group [mean difference 7.0 (95% CI 4.1, 9.9)]. Such a significant difference also existed in all the six domains of sexual function, i.e. desire, arousal, lubrication, orgasm, satisfaction and pain (p < 0.001). Providing such sexual education during routine prenatal care may improve couples' sexual health during pregnancy.