Umar ibn al-Khattab reported: We were sitting with the Messenger of Allah, peace and blessings be upon him, one day when a man appeared with very white clothes and very black hair. There were no signs of travel on him and we did not recognize him. He sat down in front of the Prophet and rested his knees by his knees and placed his hands on his thighs. The man said, “O Muhammad, tell me about Islam.” The Prophet said:
الْإِسْلَامُ أَنْ تَشْهَدَ أَنْ لَا إِلَهَ إِلَّا اللَّهُ وَأَنَّ مُحَمَّدًا رَسُولُ اللَّهِ صَلَّى اللَّهُ عَلَيْهِ وَسَلَّمَ وَتُقِيمَ الصَّلَاةَ وَتُؤْتِيَ الزَّكَاةَ وَتَصُومَ رَمَضَانَ وَتَحُجَّ الْبَيْتَ إِنْ اسْتَطَعْتَ إِلَيْهِ سَبِيلًا
Islam is to testify there is no God but Allah and Muhammad is the Messenger of Allah, to establish prayer, to give charity, to fast the month of Ramadan, and to perform pilgrimage to the House if a way is possible.
The man said, “You have spoken truthfully.” We were surprised that he asked him and then said he was truthful. He said, “Tell me about faith.” The Prophet said:
أَنْ تُؤْمِنَ بِاللَّهِ وَمَلَائِكَتِهِ وَكُتُبِهِ وَرُسُلِهِ وَالْيَوْمِ الْآخِرِ وَتُؤْمِنَ بِالْقَدَرِ خَيْرِهِ وَشَرِّهِ
Faith is to believe in Allah, His angels, His books, His messengers, the Last Day, and to believe in providence, its good and its evil.
The man said, “You have spoken truthfully. Tell me about excellence.” The Prophet said:
أَنْ تَعْبُدَ اللَّهَ كَأَنَّكَ تَرَاهُ فَإِنْ لَمْ تَكُنْ تَرَاهُ فَإِنَّهُ يَرَاكَ
Excellence is to worship Allah as if you see Him, for if you do not see Him, He surely sees you.
Ṣaḥīḥ Muslim 8, Grade: Sahih
Taken from the Forty Hadith al-Nawawi, Hadith 2