Sunan Abi Dawud 4708
‘Abd Allah b. Mas’ud said :
The Messenger of Allah (May peace be upon him) who spoke the truth and whose word was belief told us the following : The constituents of one of you are collected for forty days in his mother’s womb, then they become a piece of  congealed blood for a similar period, then they become a lump of flesh for a similar period. Then Allah sends to him an angel with four words who records his provision the period of his life, his deeds, and whether he will be miserable or blessed ; thereafter he breathes the spirit into him. One of you will do the deeds of those who go to Paradise so that there will be only a cubit between him and it or will be within a cubit, then what is decreed will overcome him so that he will do the deeds of those who go to Hell and will enter it; and one of you will do the deeds of those who go to hell, so that there will be only a cubit between him and it or will be within a cubit, then what is decreed will overcome him, so that he will do the deeds of those who go to Paradise and will enter it.
حَدَّثَنَا حَفْصُ بْنُ عُمَرَ النَّمَرِيُّ، حَدَّثَنَا شُعْبَةُ، ح وَحَدَّثَنَا مُحَمَّدُ بْنُ كَثِيرٍ، أَخْبَرَنَا سُفْيَانُ، - الْمَعْنَى وَاحِدٌ وَالإِخْبَارُ فِي حَدِيثِ سُفْيَانَ - عَنِ الأَعْمَشِ قَالَ حَدَّثَنَا زَيْدُ بْنُ وَهْبٍ حَدَّثَنَا عَبْدُ اللَّهِ بْنُ مَسْعُودٍ قَالَ حَدَّثَنَا رَسُولُ اللَّهِ صلى الله عليه وسلم وَهُوَ الصَّادِقُ الْمَصْدُوقُ ‏
"‏ إِنَّ خَلْقَ أَحَدِكُمْ يُجْمَعُ فِي بَطْنِ أُمِّهِ أَرْبَعِينَ يَوْمًا ثُمَّ يَكُونُ عَلَقَةً مِثْلَ ذَلِكَ ثُمَّ يَكُونُ مُضْغَةً مِثْلَ ذَلِكَ ثُمَّ يُبْعَثُ إِلَيْهِ مَلَكٌ فَيُؤْمَرُ بِأَرْبَعِ كَلِمَاتٍ فَيُكْتَبُ رِزْقُهُ وَأَجَلُهُ وَعَمَلُهُ ثُمَّ يُكْتَبُ شَقِيٌّ أَوْ سَعِيدٌ ثُمَّ يُنْفَخُ فِيهِ الرُّوحُ فَإِنَّ أَحَدَكُمْ لَيَعْمَلُ بِعَمَلِ أَهْلِ الْجَنَّةِ حَتَّى مَا يَكُونَ بَيْنَهُ وَبَيْنَهَا إِلاَّ ذِرَاعٌ أَوْ قِيدُ ذِرَاعٍ فَيَسْبِقُ عَلَيْهِ الْكِتَابُ فَيَعْمَلُ بِعَمَلِ أَهْلِ النَّارِ فَيَدْخُلُهَا وَإِنَّ أَحَدَكُمْ لَيَعْمَلُ بِعَمَلِ أَهْلِ النَّارِ حَتَّى مَا يَكُونَ بَيْنَهُ وَبَيْنَهَا إِلاَّ ذِرَاعٌ أَوْ قِيدُ ذِرَاعٍ فَيَسْبِقُ عَلَيْهِ الْكِتَابُ فَيَعْمَلُ بِعَمَلِ أَهْلِ الْجَنَّةِ فَيَدْخُلُهَا ‏"‏ ‏.‏