Abu Umamah (RA) reported: The Messenger of Allah (SAWS) said, “The superiority of the learned over the devout is like my superiority over the most inferior amongst you (in good deeds).” He went on to say, “Allah, His angels, the dwellers of the heaven and the earth, and even the ant in its hole and the fish (in water) supplicate in favor of those who teach people knowledge.”
Learned person or ‘alim here means scholar of the Quran and Hadith, who adheres to Faraid and Sunnah and remains busy in learning and imparting knowledge. The devout worshiper or ‘abid, on the other hand, is one who spends most of his time in the worship of Allah. The benefit of his voluntary prayer and remembrance of Allah is restricted to his own self while the benefit of knowledge of the scholar reaches others also. Hence, of the two, the latter is far superior.