Sahih Muslim Book 8, Hadith Number 3240.

Chapter: He who sees a woman and his heart is affected, should come to his wife, and should have intercourse with her.

Jabir reported that Allah’s Messenger (May peace be upon him) saw a woman, and so he came to his wife, Zainab, as she was tanning a leather and had sexual intercourse with her. He then went to his Companions and told them: The woman advances and retires in the shape of a devil, so when one of you sees a woman, he should come to his wife, for that will repel what he feels in his heart.