The one in salah who is greeted or spoken to may reply to the one who greets or speaks to him by making some motion.
Jabir said: “The Messenger of Allah sent me somewhere while he was going to the tribe of Mustaliq. I came to him and he was praying while on the back of his camel. [When] I spoke to him, he and Zubair motioned with their hands. I heard him reciting and saw him gesturing with his head. When he finished, he said: ‘What have you done about the thing I sent you for? Nothing kept me from talking to you save that I was in salah.'” This is related by Ahmad and Muslim.
‘Abdullah ibn ‘Umar narrates that Suhaib said: “I passed by the Messenger of Allah while he was offering salah. I greeted him and he responded to me by only signalling.” ‘Abdullah said: “The only thing that I know is that he said he signalled to him with his finger.” This is related by Ahmad and by at-Tirmizhi. The latter calls it sahih.
‘Abdullah ibn ‘Umar says: “I asked Suhaib: ‘How did the Messenger of Allah respond to the people when they greeted him while he was praying?’ He said: ‘He would signal to them with his hand.'” This is related by Ahmad, at-Tirmizhi, Abu Dawud, an-Nasa’i, and Ibn Majah.
Anas says that the Prophet would signal while offering salah. This is related by Ahmad, Abu Dawud, and Ibn Khuzaimah and its isnad is sahih.
The same applies to signalling with one’s finger or hand or by nodding the head. All of these actions have been related from the Prophet sallallahu alehi wasallam.