Sahih al-Bukhari, Book 97, Hadith 79 (Bukhari 7168)

Narrated Abu Huraira:

Allah's Messenger (ﷺ) said, "When Allah created the creations, He wrote with Him on His Throne: 'My Mercy has preceded My Anger."