The Messenger of Allah ﷺ recited the verse "Allah keeps firm those who believe with the firm word in the worldly life and in the Hereafter" [Ibrahim 14:27], then he said, "This refers to when a person is asked in the grave, 'Who is your Lord? What is your religion? Who is your Prophet?' He will reply, 'Allah is my Lord, Islam is my religion, and Muhammad is my Prophet. He came to us with clear proofs from Allah, so I believed in him and affirmed his truthfulness.' Then it will be said to him, 'You have spoken the truth. Upon this you lived, upon this you died, and upon this you shall be raised, if Allah wills.'"
تلا رسول الله ﷺ: {يثبت الله الذين ءامنوا بالقول الثابت في الحيوة الدنيا وفي الآخرة} فقال: ذلك إذا قيل له في القبر: من ربك؟ وما دينك؟ ومن نبيك؟ فيقول: الله ربي والإسلام ديني، ومحمد نبيي جاءنا بالبينات من عند الله فآمنت به، وصدقته فيقال: صدقت على هذا حبيت، وعليه تبعث إن شاء الله.
Bayhaqi narrated it in Ithbat Azab Qabr (8), from Muhammad bin Abdullah bin Muhammad, from Abdul-Rahman bin Husayn the judge in Hamdan, who said, Ibrahim bin Husayn told us, who said, Adam bin Abu Iyas told us, who said, Hammad bin Salama told us, from Muhammad bin Amr, from Abu Salama, from Abu Hurairah, and he mentioned it.Tabari also narrated it in his tafsir through another route from Adam bin Abu Iyas. Its isnad is hasan because of Muhammad bin Amr, who is Ibn Alqama Laythi, for he is hasan al-hadith.