Narrated Anas bin Malik
A Jew passed by Allah's Messenger (ﷺ) and said, "As-Samu 'Alaika." Allah's Messenger (ﷺ) said in reply, "We 'Alaika." Allah's Messenger (ﷺ) then said to his companions, "Do you know what he (the Jew) has said? He said, 'As-Samu 'Alaika.'" They said, "O Allah's Messenger (ﷺ)! Shall we kill him?" The Prophet, said, "No. When the people of the Book greet you, say: 'Wa 'Alaikum.'"