The Messenger of Allah ﷺ said, "Your Lord wrote with His own hand, before He created creation, 'My mercy precedes My wrath.'"
حدثنا محمد بن يحيى حدثنا صفوان بن عيسى عن ابن عجلان عن أبيه
قال رسول الله ﷺ كتب ربكم على نفسه بيده قبل أن يخلق الخلق رحمتي سبقت غضبي
Sourcing, its chain of transmission is sahih. Tirmidhi narrated it in the Book of Supplications, chapter "My mercy overcomes my anger," hadith 3543, from the hadith of Ibn Ajlan, through this route, and he said, hasan sahih gharib. Ibn Ajlan explicitly stated that he heard it directly, as found in Ahmad, 2/433. See also hadith 4295.