Jami` at-Tirmidhi, Book 41, Hadith 1 (Tirmidhi 2715)

Narrated Ibn 'Abbas:

that the Messenger of Allah (ﷺ) said: "For whomever Allah wants good, he gives him understanding in the religion.