Sunan Ibn Majah, Volume 5, Book 37, Hadith 4208 (DarusSalam)

It was narrated from ‘Abdullah bin Mas’ud that the Messenger of Allah said: “There is no (permissible) envy except in two cases: A man whom Allah has given wealth and caused him to dispose of it in a proper manner, and a man to whom Allah has given wisdom, and he acts in accordance with it and teaches it (to others).”

حَدَّثَنَا مُحَمَّدُ بْنُ عَبْدِ اللَّهِ بْنِ نُمَيْرٍ، حَدَّثَنَا أَبِي وَمُحَمَّدُ بْنُ بِشْرٍ، قَالاَ حَدَّثَنَا إِسْمَاعِيلُ بْنُ أَبِي خَالِدٍ، عَنْ قَيْسِ بْنِ أَبِي حَازِمٍ، عَنْ عَبْدِ اللَّهِ بْنِ مَسْعُودٍ، قَالَ قَالَ رَسُولُ اللَّهِ ـ صلى الله عليه وسلم ـ ‏ "‏ لاَ حَسَدَ إِلاَّ فِي اثْنَتَيْنِ رَجُلٌ آتَاهُ اللَّهُ مَالاً فَسَلَّطَهُ عَلَى هَلَكَتِهِ فِي الْحَقِّ وَرَجُلٌ آتَاهُ اللَّهُ حِكْمَةً فَهُوَ يَقْضِي بِهَا وَيُعَلِّمُهَا ‏" ‏ ‏.‏

sunnah.com