عَنْ عُبَادَةَ بْنِ الصَّامِتِ رَضِيَ اللَّهُ عَنْهُ قَالَ سَمِعْتُ رَسُولَ اللَّهِ صَلَّى اللَّهُ عَلَيْهِ وَآلِهِ وَسَلَّمَ يَقُولُ ((أَوَّلُ مَا خَلَقَ اللَّهُ تَبَارَكَ وَتَعَالَى الْقَلَمَ ثُمَّ قَالَ لَهُ اكْتُبْ فَجَرَى فِي تِلْكَ السَّاعَةِ بِمَا هُوَ كَائِنٌ إِلَى يَوْمِ الْقِيَامَةِ))
It is narrated from Sayyiduna Ubadah bin Samit (may Allah be pleased with him), the Messenger of Allah (peace and blessings be upon him) said: Allah Almighty created the Pen first and then said to it: Write. So it began to move at that very moment and wrote down all matters that would occur until the Day of Judgment.