It was narrated from Abu Hurairah that the Prophet (ﷺ) said:
“The dead person ends up in his grave, then the righteous man is made to sit up in his grave with no fear or panic. Then it is said to him: ‘What religion did you follow?’ He said: ‘I was in Islam.’ It is said to him: ‘Who is this man?’ He says: ‘Muhammad the Messenger of Allah (ﷺ). He brought us clear signs from Allah and we believed him.’ It is said to him: ‘Have you seen Allah?’ He says: ‘No one is able to see Allah.’ Then a window to Hell is opened for him, and he sees it, parts of it destroying others. Then it is said to him: ‘Look at what Allah has saved you from.’ Then a window to Paradise is opened to him, and he looks at its beauty and what is in it. It is said to him: ‘This is your place.’ And it is said to him: ‘You had certain faith and you died in that state, and in that state you will be resurrected if Allah wills.’ And the evil man is made to sit up in his grave with fear and panic. It is said to him: ‘What religion did you follow?’ He says: ‘I do not know.’ It is said to him: ‘Who is this man?’ He says: ‘I heard the people saying something and I said it too.’ Then a window to Paradise is opened to him, and he looks at its beauty and what is in it. It is said to him: ‘Look at what Allah has diverted away from you.’ Then a window to Hell is opened for him, and he sees it, parts of it destroying others, and it is said to him: ‘This is your place. You were doubtful; in this state you died and in this state you will be resurrected, if Allah wills.’”