It is narrated from Sayyiduna Abdullah bin Umar (may Allah be pleased with them both) that the Messenger of Allah (peace and blessings be upon him) came to the Masjid of Quba and began to pray, and people began coming in and greeting him (peace and blessings be upon him) with salam. When he (peace and blessings be upon him) came out, I asked (the one who had been with him (peace and blessings be upon him)): "How did the Messenger of Allah (peace and blessings be upon him) reply to their greetings?" So he did like this with his hand, and showed it by gesturing with it.
Related hadith on this topic