Background notes and the Questions to consider when reading the Hadith excerpt. From way back in the 1990s, you can also check some further information that I put together about this document as a txt file.
Sources: 40 Hadith Nawawi; Translation of Imam An-Nawawi's Forty Hadiths. This is the book of the Islamic scholar Yahia bin Sharaful-Deen Al-Nawawi (13th century CE), now known as Al-Nawawi's Forty Hadiths.
(1) I heard the Messenger of Allah (may the blessings and peace of Allah be upon him) say: Islam has been built on five [pillars]: testifying that there is no god but Allah and that Muhammad is the Messenger of Allah, performing the prayers, paying the zakat, making the pilgrimage to the House, and fasting in Ramadan.
(2) Also on the authority of Umar (may Allah be pleased with him), who said: One day while we were sitting with the Messenger of Allah (may the blessings and peace of Allah be upon him) there appeared before us a man whose clothes were exceedingly white and whose hair was exceedingly black; no signs of journeying were to be seen on him and none of us knew him. He walked up and sat down by the prophet (may the blessings and peace of Allah be upon him). Resting his knees against his and placing the palms of his hands on his thighs, he said: O Muhammad, tell me about Islam. The Messenger of Allah (may the blessings and peace of Allah be upon him) said: Islam is to testify that there is no god but Allah and Muhammad is the Messenger of Allah, to perform the prayers, to pay the zakat, to fast in Ramadan and to make the pilgrimage to the House if you are able to do so. He said: You have spoken rightly, and we were amazed at him for asking him and saying that he had spoken rightly. He said: Then tell me about "iman." He said: It is to believe in Allah, His angels, His books, His messengers, and the Last Day, and to believe in divine destiny, both the good and evil thereof. He said: You have spoken rightly. He said: Then tell me about "ihsan." He said: It is to worship Allah as though you are seeing Him, and while you see Him not yet truly he sees you. He said: Then tell me about the Hour. He said: The one questioned about it knows no better than the questioner. He said: Then tell me about its signs. He said: That the slave girl will give birth to her mistress and that you will see the barefooted, naked, destitute herdsmen competing in constructing lofty buildings. Then he took himself off and I stayed for a time. Then he said: O Umar, do you know who the questioner was? I said: Allah and His Messenger know best. He said: It was Gabriel, who came to teach you your religion.
(4) On the authority of Abu `Abd ar Rahman `Abdullah ibn Mas'ud (may Allah be pleased with him), who said: The Messenger of Allah (may the blessings and peace of Allah be upon him), and he is the truthful, the believed, narrated to us: Verily the creation of each one of you is brought together in his mother's belly for forty days in the form of a seed, then he is a clot of blood for a like period, then a morsel of flesh for a like period, then there is sent to him the angel who blows the breath of life into him and who is commanded about four matters: to write down his means of livelihood, his life span, his actions, and whether happy or unhappy. By Allah, other than Whom there is no god, verily one of you behaves like the people of Paradise until there is but an arm's length between him and it, and that which has been written overtakes him and so he behaves like the people of Hellfire and thus he enters it, and one of you behaves like the people of Hellfire until there is but an arm's length between him and it, and that which has been written overtakes him and so he behaves like the people of Paradise and thus he enters it.
(6) On the authority of Abu `Abdullah an Nu`man the son of Bashir may Allah be pleased with them both, who said: I heard the Messenger of Allah (may the blessings and peace of Allah be upon him) say: That which is lawful is plain and that which is unlawful is plain and between the two of them are doubtful matters which not many people know. Thus he who avoids doubtful matters clears himself in regard to his religion and his honour, but he who falls into doubtful matters falls into that which is unlawful, like the shepherd who pastures around a sanctuary, all but grazing therein. Truly every king has a sanctuary, and truly Allah's sanctuary is His prohibitions. Truly in the body there is a morsel of flesh which, if it be whole, all the body is whole and which, if it be diseased, all of it is diseased. Truly it is the heart.