Hadithcore
Mishkat al-Masabih, 2364

Abu Huraira reported God’s messenger as saying, “When God completed the creation He wrote the following which is with Him above His Throne, ‘My mercy has taken precedence over my anger’.” A version says, “Has prevailed over my anger.” (Bukhari and Muslim).

عَنْ أَبِي هُرَيْرَةَ قَالَ: قَالَ رَسُولُ اللَّهِ صَلَّى اللَّهُ عَلَيْهِ وَسَلَّمَ:

لَمَّا قَضَى اللَّهُ الْخَلْقَ كَتَبَ كِتَابًا فَهُوَ عِنْدَهُ فَوْقَ عَرْشِهِ: إِنَّ رَحْمَتِي سَبَقَتْ غَضَبِي «. وَفِي رِوَايَةٍ» غَلَبَتْ غَضَبي

References1 variant
In-Book Reference
Book 9, Hadith 137