Imam An-Nawawi wrote in his Sharh Sahih Muslim [Arabic text and English translation below]:
As for his saying, peace be upon him,:
In it is a tremendous encouragement to spread peace and to offer it to all of the Muslims, those you know and those you do not know, such as had come in other Hadith. And the Salaam [greeting of peace] is the first of the causes of reconciliation, the key to attracting affection – this is the significance of the Salaam – and in spreading it is the possibility ofأَفْشُوا السَّلَامَ بَيْنَكُمْSpread peace between yourselves
bringing the Muslims together. It shows the distinctive slogan for them to others from the people of religion, with what is in it of exercising the soul, and the necessity of humility, and the great sanctity of the Muslims.
It has been mentioned by Al-Bukhari, may Allah have mercy on him, in the Two Sahihs [Bukhari and Muslim] on the authority of Amar ibn Yasir, may Allah be pleased with him, that he said:
This is narrated by other than Al-Bukhari. This speech is raised to the Prophet. [The Prophetic sayings] “to offer peace to the world,” and “peace to those you know and do not know,” and “spread peace” all have a single meaning.ثَلَاثٌ مَنْ جَمَعَهُنَّ فَقَدْ جَمَعَ الْإِيمَانَ : الْإِنْصَافُ مِنْ نَفْسِكَ ، وَبَذْلُ السَّلَامِ لِلْعَالَمِ ، وَالْإِنْفَاقُ مِنَ الْإِقْتَارِWhoever has three [signs] together will have gathered the Faith: Equity with yourself, offering peace to the world, and spending from small amounts.
[Sharh Sahih Muslim, Book 1, Number 96]
وَأَمَّا قَوْلُهُ
أَفْشُوا السَّلَامَ بَيْنَكُمْ
وَفِيهِ الْحَثُّ الْعَظِيمُ عَلَى إِفْشَاءِ السَّلَامِ
وَبَذْلِهِ لِلْمُسْلِمِينَ كُلِّهِمْ ; مَنْ عَرَفْتَ ، وَمَنْ لَمْ
تَعْرِفْ ، كَمَا تَقَدَّمَ فِي الْحَدِيثِ الْآخَرِ . وَالسَّلَامُ
أَوَّلُ أَسْبَابِ التَّأَلُّفِ ، وَمِفْتَاحُ اسْتِجْلَابِ الْمَوَدَّةِ –
اهمية السلام - . وَفِي إِفْشَائِهِ تَمَكُّنُ أُلْفَةِ الْمُسْلِمِينَ
بَعْضُهُمْ لِبَعْضٍ ، وَإِظْهَارُ شِعَارِهِمُ الْمُمَيِّزِ لَهُمْ مِنْ
غَيْرِهِمْ مِنْ أَهْلِ الْمِلَلِ ، مَعَ مَا فِيهِ مِنْ رِيَاضَةِ
النَّفْسِ ، وَلُزُومِ التَّوَاضُعِ ، وَإِعْظَامِ حُرُمَاتِ
الْمُسْلِمِينَ
وَقَدْ ذَكَرَ الْبُخَارِيُّ رَحِمَهُ اللَّهُ فِي صَحِيحِهِ عَنْ عَمَّارِ بْنِ يَاسِرٍ رَضِيَ اللَّهُ عَنْهُ – أَنَّهُ قَالَ
ثَلَاثٌ مَنْ جَمَعَهُنَّ فَقَدْ جَمَعَ
الْإِيمَانَ : الْإِنْصَافُ مِنْ نَفْسِكَ ، وَبَذْلُ السَّلَامِ
لِلْعَالَمِ ، وَالْإِنْفَاقُ مِنَ الْإِقْتَارِ
رَوَى غَيْرُ الْبُخَارِيِّ هَذَا الْكَلَامَ مَرْفُوعًا إِلَى النَّبِيِّ – صَلَّى اللَّهُ عَلَيْهِ وَسَلَّمَ وَبَذْلُ السَّلَامِ لِلْعَالَمِ ، وَالسَّلَامُ عَلَى مَنْ عَرَفْتَ وَمَنْ لَمْ تَعْرِفْ ، وَإِفْشَاءُ السَّلَامِ كُلُّهَا بِمَعْنَى وَاحِدٍ