Mishkat al-Masabih 213
وَعَن أبي أُمَامَة الْبَاهِلِيّ قَالَ: ذُكِرَ لِرَسُولِ اللَّهِ صَلَّى اللَّهُ عَلَيْهِ وَسَلَّمَ رَجُلَانِ أَحَدُهُمَا عَابِدٌ وَالْآخَرُ عَالِمٌ فَقَالَ رَسُولُ اللَّهِ صَلَّى اللَّهُ عَلَيْهِ وَسَلَّمَ: «فَضْلُ الْعَالِمِ عَلَى الْعَابِدِ كَفَضْلِي عَلَى أَدْنَاكُمْ» ثُمَّ قَالَ رَسُولُ اللَّهِ صَلَّى اللَّهُ عَلَيْهِ وَسَلَّمَ: «إِنَّ اللَّهَ وَمَلَائِكَتَهُ وَأَهْلَ السَّمَاوَاتِ وَالْأَرْضِ حَتَّى النَّمْلَةَ فِي جُحْرِهَا وَحَتَّى الْحُوتَ لَيُصَلُّونَ عَلَى معلم النَّاس الْخَيْر» . رَوَاهُ التِّرْمِذِيّ وَقَالَ حسن غَرِيب
From Abu Umamah al-Bahili, who said: Two men were mentioned to the Messenger of Allah ﷺ, one of them a worshipper and the other a scholar. The Messenger of Allah ﷺ said: "The superiority of the scholar over the worshipper is like my superiority over the lowest of you." Then the Messenger of Allah ﷺ said: "Allah, His angels, and the inhabitants of the heavens and the earth, even the ant in its hole and even the fish, send blessings upon the one who teaches people good." Reported by at-Tirmidhi, who said: Hasan gharib.