Jami` at-Tirmidhi, Book 32, Hadith 2284 (In-Book) ⓘ
'Abdullah bin Mas'ud said: The Messenger of Allah (s.a.w) narrated to us - and he is the truthful and entrusted one: 'Indeed the creation of one of you is gathered inside his mother in forty days. Then, for a similar period, he is a clot. Then, for a similar period, he is a piece of flesh. Then Allah sends the angel to him to blow the soul into him, and he is ordered to write four (things): To write his provision, his life-span, his works, and whether he will be wretched or happy. By the One besides Whom there is none other worthy of worship! One of you will do deeds of the people of Paradise, until there is between him and it but a forearm span, then he is overcome by what is written for him, and he is sealed off with the deeds of the people of the Fire, so that he enters it. And indeed one of you will do deeds of the people of the Fire, until there is between him and it but a forearm span, then he is overcome by what is written for him, and he is sealed off with the deeds of the people of Paradise, so that he enters it.'"
حَدَّثَنَا هَنَّادٌ، حَدَّثَنَا أَبُو مُعَاوِيَةَ، عَنِ الأَعْمَشِ، عَنْ زَيْدِ بْنِ وَهْبٍ، عَنْ عَبْدِ اللَّهِ بْنِ مَسْعُودٍ، قَالَ حَدَّثَنَا رَسُولُ اللَّهِ صلى الله عليه وسلم وَهُوَ الصَّادِقُ الْمَصْدُوقُ " إِنَّ أَحَدَكُمْ يُجْمَعُ خَلْقُهُ فِي بَطْنِ أُمِّهِ فِي أَرْبَعِينَ يَوْمًا ثُمَّ يَكُونُ عَلَقَةً مِثْلَ ذَلِكَ ثُمَّ يَكُونُ مُضْغَةً مِثْلَ ذَلِكَ ثُمَّ يُرْسِلُ اللَّهُ إِلَيْهِ الْمَلَكَ فَيَنْفُخُ فِيهِ وَيُؤْمَرُ بِأَرْبَعٍ يَكْتُبُ رِزْقَهُ وَأَجَلَهُ وَعَمَلَهُ وَشَقِيٌّ أَوْ سَعِيدٌ فَوَالَّذِي لاَ إِلَهَ غَيْرُهُ إِنَّ أَحَدَكُمْ لَيَعْمَلُ بِعَمَلِ أَهْلِ الْجَنَّةِ حَتَّى مَا يَكُونُ بَيْنَهُ وَبَيْنَهَا إِلاَّ ذِرَاعٌ ثُمَّ يَسْبِقُ عَلَيْهِ الْكِتَابُ فَيُخْتَمُ لَهُ بِعَمَلِ أَهْلِ النَّارِ فَيَدْخُلُهَا وَإِنَّ أَحَدَكُمْ لَيَعْمَلُ بِعَمَلِ أَهْلِ النَّارِ حَتَّى مَا يَكُونُ بَيْنَهُ وَبَيْنَهَا إِلاَّ ذِرَاعٌ ثُمَّ يَسْبِقُ عَلَيْهِ الْكِتَابُ فَيُخْتَمُ لَهُ بِعَمَلِ أَهْلِ الْجَنَّةِ فَيَدْخُلُهَا " . قَالَ أَبُو عِيسَى وَهَذَا حَدِيثٌ حَسَنٌ صَحِيحٌ .
also referenced under: Hadith 2137 (Reference) & Volume 4, Book 30, Hadith 2137 (DarusSalam)