Envy is one of the most destructive qualities it is possible for a human heart to house. We are instructed in the Qur’an to seek Allah’s protection from it: “…and from the evil of an envier when he envies.” (113:5) The Prophet, peace be upon him, said of it: “Beware of envy. Envy devours good actions as fire devours wood” (or he said “dry grass”). (Abu Dawud)
There are different degrees of envy. There is the envy when someone resents what someone else has and both desires it for themselves and to deprive the other person of it. This is the worst kind of envy. There is envy of wanting what someone else has without wanting to deprive them of it. There is also the kind of envy displayed by someone who resents what someone else has but realises that they cannot have it and so they want the other person to lose it so that they can be the same. All these are destructive to the heart.
The Prophet, peace be upon him, gave permission to envy in two instances: Ibn Mas`ud reported that the Prophet, peace be upon him, said, “You can only have envy in two situations: you may envy a man to whom Allah has given wealth which he spends for the sake of the truth, and a man to whom Allah has given wisdom which he both acts by and teaches.” (Al-Bukhari and Muslim)
(Islam – Its Basic Practices and Beliefs, Abdalhaqq Bewley)