Narrated Ibn 'Umar:
While some people were offering Fajr prayer at Quba mosque, someone came to them and said, "Quranic literature" has been revealed to Allah's Apostle tonight, and he has been ordered to face the Ka'ba (of Mecca) so you too, should turn your faces towards it. Their faces were then towards Sham (Jerusalem), so they turned towards the Qibla (i.e. Ka'ba of Mecca)."
Sahih al-Bukhari, Vol. 6, Book of Prophetic Commentary on the Qur'an, Hadith 21
Sahih al-Bukhari, Book of Prophetic Commentary on the Qur'an, Hadith 21