Ibn Mas’ood (radiyAllahu ‘anhumaa) narrates that Allah’s Messenger (salAllahu ‘alaihi wa’sallam) said:
“There is to be no envy except with regard to two: A man whom Allah has given wealth which he strives to spend righteously, and a man to whom Allah has given the Wisdom (i.e. the Qur’an) and he acts according to it and teaches it to others.”
If he were to have envy of the people he would hope for their downfall in order to satisfy the pride that he has in himself, his vanity and the conceitedness of his mind. So he (the Muslim) knows that envy is a dangerous disease and a harmful evil and therefore keeps away from it.
As for the envy which is accepted from that which is sinful, then it is envy which does not cause the person to be afflicted by the sickness of wishing for that blessing to leave the other person. Rather he supplicates to his Lord, the One free of all imperfections, for his brother; that Allah should protect him, and for himself; that Allah should make him like him. As for that which is at variance with this, then it is blameworthy and to be condemned.
 See Fath ul Bari (1/167)
 Reported by al-Bukhari (Eng. Trans. 1/62/no.73)
 Refer to the treatise Dhammul Hasad wa Ahlihi of Ibn ul Qayyim