It is narrated from Sayyiduna Ibn Abbas (may Allah be pleased with them both) that the Messenger of Allah (peace and blessings be upon him) said: "Whomever Allah Almighty intends good for, He gives him understanding of the religion."
Imam al-Tirmidhi (may Allah have mercy on him) narrated it through Ali bin Hujr from Isma'il, and said: "This hadith is sahih."
The hadith of Sayyiduna Mu'awiyah bin Abi Sufyan (may Allah be pleased with him) in the two Sahihs is a supporting witness for it.