Imam Qatadah (may Allah have mercy on him) narrates, through Sa'id bin al-Musayyab (may Allah have mercy on him), from Sayyiduna Mu'awiyah (may Allah be pleased with him) that the Messenger of Allah (peace and blessings be upon him) said: "Whoever Allah intends good for, He grants him understanding of the religion."
Hadith Referenceالمعجم الكبير للطبراني / باب الميم / 16778