It is narrated from Sayyiduna Ibn Abbas (may Allah be pleased with them both), concerning this saying of Allah Almighty: "Allah keeps firm those who believe with the firm word in the life of this world," that he said: "What is meant is the questioning in the grave: Who is your Lord? And what is your religion? And in the Hereafter it will be likewise."
It has a supporting narration (shahid) in Sahih al-Bukhari and Muslim, through the narration of Sa'd bin Ubaydah (may Allah have mercy on him) from Sayyiduna al-Bara' bin Azib (may Allah be pleased with them both): "When the believer, in his grave, bears witness that there is no god but Allah and recognises Muhammad (peace and blessings be upon him), that is what is meant by this saying of Allah Almighty: 'Allah keeps firm those who believe with the firm word in the life of this world.'"
Related hadith on this topic