كتاب الإمارة
33  
The Book on Government
(53)
Chapter: The words of the prophet saws: "A Group of my Ummah will continue to Prevail on the basis of the Truth, and They will not be Harmed by those who oppose them."
(53)
باب قَوْلِهِ صَلَّى اللَّهُ عَلَيْهِ وَسَلَّمَ: «لاَ تَزَالُ طَائِفَةٌ مِنْ أُمَّتِي ظَاهِرِينَ عَلَى الْحَقِّ لاَ يَضُرُّهُمْ مَنْ خَالَفَهُمْ»
Sahih Muslim 1037 c

It his been narrated on the authority of Umair b. Umm Hani who said:

I heard Mu'awiya say (while delivering a sermon from the pulpit) that he heard the Messenger of Allah (ﷺ) say: A group of people from my Umma will continue to obey Allah's Command, and those who desert or oppose them shall not be able to do them any harm. They will be dominating the peeple until Allah's Command is executed (i. e. Resurrection is established).
حَدَّثَنَا مَنْصُورُ بْنُ أَبِي مُزَاحِمٍ، حَدَّثَنَا يَحْيَى بْنُ حَمْزَةَ، عَنْ عَبْدِ الرَّحْمَنِ بْنِ يَزِيدَ، بْنِ جَابِرٍ أَنَّ عُمَيْرَ بْنَ هَانِئٍ، حَدَّثَهُ قَالَ سَمِعْتُ مُعَاوِيَةَ، عَلَى الْمِنْبَرِ يَقُولُ سَمِعْتُ رَسُولَ اللَّهِ صلى الله عليه وسلم يَقُولُ ‏ "‏ لاَ تَزَالُ طَائِفَةٌ مِنْ أُمَّتِي قَائِمَةً بِأَمْرِ اللَّهِ لاَ يَضُرُّهُمْ مَنْ خَذَلَهُمْ أَوْ خَالَفَهُمْ حَتَّى يَأْتِيَ أَمْرُ اللَّهِ وَهُمْ ظَاهِرُونَ عَلَى النَّاسِ ‏"‏ ‏.‏
Reference : Sahih Muslim 1037c
In-book reference : Book 33, Hadith 250
USC-MSA web (English) reference : Book 20, Hadith 4719
  (deprecated numbering scheme)