Sahih al-Bukhari, Book 97, Hadith 50 (In-Book) ⓘ
Narrated Abu Huraira: The Prophet said, "When Allah had finished His creation, He wrote over his Throne: 'My Mercy preceded My Anger.'
حَدَّثَنَا أَبُو الْيَمَانِ، أَخْبَرَنَا شُعَيْبٌ، حَدَّثَنَا أَبُو الزِّنَادِ، عَنِ الأَعْرَجِ، عَنْ أَبِي هُرَيْرَةَ، عَنِ النَّبِيِّ صلى الله عليه وسلم قَالَ " إِنَّ اللَّهَ لَمَّا قَضَى الْخَلْقَ كَتَبَ عِنْدَهُ فَوْقَ عَرْشِهِ إِنَّ رَحْمَتِي سَبَقَتْ غَضَبِي " .
also referenced under: Hadith 7422 (DarusSalam) & Volume 9, Book 93, Hadith 518 (USC-MSA)