The Prophet ﷺ said: There is jealousy which Allah loves and jealousy which Allah hates. That which Allah loves is jealousy regarding a matter of doubt, and that which Allah hates is jealousy regarding something which is not doubtful. There is pride which Allah hates and pride which Allah loves. That which Allah loves is a man's pride when fighting and when giving sadaqah and that which Allah hates is pride shown by oppression. The narrator Musa said: "by boasting." (Using translation from Abū Dāʾūd 2659)
وقَالَ قَالَ رَسُولُ اللهِ ﷺ «إِنَّ مِنَ الْغَيْرَةِ مَا يُحِبُّ اللهُ وَمِنْهَا مَا يَبْغَضُ وَمِنَ الْخُيَلَاءِ مَا يُحِبُّ اللهُ وَمِنْهَا مَا يَبْغَضُ اللهُ فَأَمَّا الْغَيْرَةُ الَّتِي يُحِبُّ اللهُ فَالْغَيْرَةُ فِي الرِّيبَةِ وَأَمَّا الْغَيْرَةُ الَّتِي يَبْغَضُ اللهُ فَالْغَيْرَةُ فِي غَيْرِ رِيبَةٍ وَالِاخْتِيَالُ الَّذِي يُحِبُّ اللهُ اخْتِيَالُ الرَّجُلِ بِنَفْسِهِ عِنْدَ الْقِتَالِ وَعِنْدَ الصَّدَقَةِ وَالِاخْتِيَالُ الَّذِي يَبْغَضُ اللهُ الْخُيَلَاءُ فِي الْبَاطِلِ»