Narrated Ibn Masud:
I heard the Prophet saying, “There is no envy except in two: a person whom Allah has given wealth and he spends it in the right way, and a person whom Allah has given wisdom (i.e. religious knowledge) and he gives his decisions accordingly and teaches it to the others.”
Taking the first part of the Hadith “there is no envy“, we get to know that Prophet (SAW) forbade envy (hasad).
The prohibited kind of envy (hasad), according to the scholars, means wishing that a blessing that Allaah The Almighty has bestowed upon the envied person be taken away. It is an abhorrent act.
As for what is mentioned in the Hadeeth: “No envy except in two (things)”, what is actually meant here is admiration (permissible envy), which is unlike envy, where one wishes for himself a blessing like that which someone else has, without wanting it to be taken away from the other person. Actually, the word envy here is used as a kind of rhetoric language.
Ibn Hajar in Fat-hul-Baari, said,
“The kind of envy that is mentioned in the Hadeeth is admiration. It is rhetorically used in this regard. It is to wish for a blessing like that which someone else has, without wanting it to be taken away from the other person. It is a good form of competition, as if he, (i.e. the Prophet ), is saying, ‘There is no better or greater admiration than admiration regarding these two things.’”
Shaykh Saalih al-Fawzaan was asked about the difference between envy (hasad) and jealousy (rashk/permissible envy/admiration). He said:
Envy is a despicable characteristic, a blameworthy characteristic and our messenger sallahu ‘alayhi wasallam said: and do not envy one another [Muslim 6214].
If a person finds within himself something for his brother, envy is to wish for the favor to be removed, this is the accurate meaning of it, to wish for the favor to be removed from the one being envied.
So if a person finds something from that within himself then let him seek refuge with Allah from it and he should supplicate for blessings for his brother/sister and ask Allah from his bounty the likes of what he has given your brother to give it to you as Allah says:
(And do not wish for the things in which Allah has made some of you excel others. For men there is a reward for what they have earned (and likewise) for women there is a reward for what they have earned, and ask Allah of his bounty. Surely, Allah is Ever All Knower of everything. 4: 32)
So envy is a wicked attribute and the envier he doesn’t harm anyone except himself, the envier he only harms himself and envy it only destroys the one who possesses it. It is upon the one who finds this characteristic within his/herself to seek refuge with Allah from the evil of envy, to supplicate for his brothers for blessings and to ask Allah from his bounty for himself.
As for jealousy, then it doesn’t have any evny in it at all. Jealousy is for a person to wish to have the like, to have the same as the one who has this favor whether it be from worship or knowledge or an abundance of wealth, so he asks Allah or he wishes to be like this individual who Allah has favored.
This is something admirable and is not blameworthy. That which is blameworthy is to wish for the favor to be stripped away from your brother/sister, as for you hoping to be given the like of what your brother has been given and you ask Allah for that then this is something honorable and this is jealousy. The messenger sallahu ‘alayhi wasallam said: There is no envy except in two instances meaning no jealousy except in two instances, a man Allah has given knowledge, Allah has given him the quran so he stands with it at night and in the daytime and in another wording Allah has given him wisdom so he teaches it and judges between the people by it. And a man Allah has given wealth and he spends it in the way of Allah [Bukhari 152, Muslim 816].
So whoever wishes to be like these then this is jealousy and it is an honorable thing and it isn’t from envy, na’am.
More on the disease of envy [by Imam ibn Taimiyyah] here.