Sayyiduna al-Harith al-Ash'ari (may Allah be pleased with him) says that the Messenger of Allah (peace and blessings be upon him) said: "Indeed Allah, the Mighty and Majestic, commanded Yahya bin Zakariyya (peace be upon them both) with five things: that he himself act upon them and command the Children of Israel to act upon them as well. He began to delay somewhat in this, so Isa (peace be upon him) said to him: 'You have been commanded with five things, to act upon them yourself and to command the Children of Israel to act upon them. So either you command them, or I will command them.' He said: 'Do not do that, my brother, for I fear that if you reach them before me, I will be punished or made to sink into the earth.' So he gathered the people in Bayt al-Maqdis until it was full, and he sat on a raised place, praised Allah and extolled Him, then admonished them, saying: 'Indeed Allah, the Mighty and Majestic, has commanded me with five things: that I act upon them and that I command you to act upon them as well. The first of them is that you worship Allah and do not associate anything with Him. The example of that is a man who bought a slave with gold or silver from his own pure wealth, then said: This is my house and this is my work, so work and render your work to me. The slave kept working, but rendered his work to someone other than his master. Which of you would be pleased for his slave to be like that, working and rendering his work to someone else? Indeed Allah created you and provided for you, so worship Him and do not associate anything with Him. And He commanded you to pray, so when you pray, do not look about, for Allah, the Mighty and Majestic, keeps His Face directed towards the face of His servant as long as he does not look about. And He commanded you to fast, and the example of that is a man with a group of people, and he has a pouch of musk, and all of them love to smell its fragrance; and indeed the smell of the fasting person's mouth is better with Allah than the fragrance of musk. And He commanded you to give charity, and the example of that is a man whom the enemy took captive; they tied his hand to his neck and brought him forward to strike his neck, and he said: I will ransom myself from you. So he began giving little and much until he freed himself. And He commanded you to remember Allah much, and the example of the remembrance of Allah, the Mighty and Majestic, is a man whom the enemy is seeking, rushing on his trail, until he comes to a strong fortress and secures himself in it. And the servant is most protected from Satan when he is engaged in the remembrance of Allah Almighty.'" The narrator says: And on that occasion the Messenger of Allah (peace and blessings be upon him) said: "And I command you with five things which Allah has commanded me: staying with the Jama'ah (the community), listening, obeying, emigration (hijrah), and jihad in the path of Allah. Whoever separates from the Jama'ah by even a handspan has thrown off the noose of Islam from his neck, unless he returns. And whoever calls with the call of the Jahiliyyah is among those who fall on their knees in Hell." A man asked: O Messenger of Allah, even if he fasts and prays? He (peace and blessings be upon him) said: "Even if he fasts and prays."
Hadith Referenceالمعجم الكبير للطبراني / باب الحاء / 3414