Sahih al-Bukhari, Hadith 4488

Narrated Ibn `Umar: While some people were offering Fajr prayer in the Quba' mosque, some-one came and said, "Allah has revealed to the Prophet Qur'anic instructions that you should face the Ka`ba (while praying) so you too, should face it." Those people then turned towards the Ka`ba.

حَدَّثَنَا مُسَدَّدٌ، حَدَّثَنَا يَحْيَى، عَنْ سُفْيَانَ، عَنْ عَبْدِ اللَّهِ بْنِ دِينَارٍ، عَنِ ابْنِ عُمَرَ ـ رضى الله عنهما ـ بَيْنَا النَّاسُ يُصَلُّونَ الصُّبْحَ فِي مَسْجِدِ قُبَاءٍ إِذْ جَاءَ جَاءٍ فَقَالَ أَنْزَلَ اللَّهُ عَلَى النَّبِيِّ صلى الله عليه وسلم قُرْآنًا أَنْ يَسْتَقْبِلَ الْكَعْبَةَ فَاسْتَقْبِلُوهَا‏.‏ فَتَوَجَّهُوا إِلَى الْكَعْبَةِ‏.‏

sunnah.com