Sahih Muslim Book 4, Hadith Number 1544.

Chapter : Excellence of greeting the mosque with two Rak’ahs and undesirability of sitting down before observing them.

Jabir b. ‘Abdullah reported: I went with the Messenger of Allah (may peace be upon him) on an expedition and my camel delayed me and I was exhausted. The Messenger of Allah (may peace be upon him) thus came earlier than I, whereas I came on the next day and went to the mosque and found him (the Holy Prophet) at the gate of the mosque. He said: It is now that you have come. I said: Yes. He said: Leave your camel and enter (the mosque) and observe two rak’ahs. He (the narrator) said: So I entered and observed (two rak’ahs) of prayer and then went back.