Sayyiduna Mu'awiyah bin Abi Sufyan (may Allah be pleased with him) used to say: I heard the Messenger of Allah (peace and blessings be upon him) say: "Whoever Allah intends good for, He grants him understanding of the religion."
Hadith Referenceالمعجم الكبير للطبراني / باب الميم / 16967