كتاب الإمارة
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 d

It has been related by, Yazid b. al-Asamm that he heard Mu'awiya b. Abu Sfyan quote a tradition from the Prophet (ﷺ) which he related from the Prophet (mail peace he upon him) -and he did not hear him quote from the Prophet (masy peace be upon him) any tradition other than this in the course of his sermon from the pulpit-that whom Allah wants to do a favour, He grants him an understanding of religion. A group of people from the Muslims will remain on the Right Path and continue until the Day of Judgment to triumph over those who oppose them.

وَحَدَّثَنِي إِسْحَاقُ بْنُ مَنْصُورٍ، أَخْبَرَنَا كَثِيرُ بْنُ هِشَامٍ، حَدَّثَنَا جَعْفَرٌ، - وَهُوَ ابْنُ بُرْقَانَ - حَدَّثَنَا يَزِيدُ بْنُ الأَصَمِّ، قَالَ سَمِعْتُ مُعَاوِيَةَ بْنَ أَبِي سُفْيَانَ، ذَكَرَ حَدِيثًا رَوَاهُ عَنِ النَّبِيِّ صلى الله عليه وسلم لَمْ أَسْمَعْهُ رَوَى عَنِ النَّبِيِّ صلى الله عليه وسلم عَلَى مِنْبَرِهِ حَدِيثًا غَيْرَهُ قَالَ قَالَ رَسُولُ اللَّهِ صلى الله عليه وسلم ‏ "‏ مَنْ يُرِدِ اللَّهُ بِهِ خَيْرًا يُفَقِّهْهُ فِي الدِّينِ وَلاَ تَزَالُ عِصَابَةٌ مِنَ الْمُسْلِمِينَ يُقَاتِلُونَ عَلَى الْحَقِّ ظَاهِرِينَ عَلَى مَنْ نَاوَأَهُمْ إِلَى يَوْمِ الْقِيَامَةِ ‏"‏ ‏.‏
Reference : Sahih Muslim 1037d
In-book reference : Book 33, Hadith 251
USC-MSA web (English) reference : Book 20, Hadith 4720
  (deprecated numbering scheme)