Abu Huraira reported God’s Messenger as saying, “One prayer in this mosque of mine (i.e. the mosque in Medina) is better than a thousand elsewhere, except the sacred mosque.”
وَعَنْ عَبْدِ اللَّهِ بْنِ عُمَرَ أَنَّ رَسُولَ اللَّهِ صَلَّى اللَّهُ عَلَيْهِ وَسَلَّمَ دخل الْكَعْبَة وَأُسَامَة بن زيد وبلال وَعُثْمَان بن طَلْحَة الحَجبي فَأَغْلَقَهَا عَلَيْهِ وَمَكَثَ فِيهَا فَسَأَلْتُ بِلَالًا حِينَ خَرَجَ مَاذَا صَنَعَ رَسُولُ اللَّهِ صَلَّى اللَّهُ عَلَيْهِ وَسَلَّمَ فَقَالَ: جعل عمودا عَن يَسَارِهِ وَعَمُودَيْنِ عَنْ يَمِينِهِ وَثَلَاثَةَ أَعْمِدَةٍ وَرَاءَهُ وَكَانَ الْبَيْتُ يَوْمَئِذٍ عَلَى سِتَّةِ أَعْمِدَةِ ثُمَّ صلى
Narrated ‘Abdallah b. ‘Umar said:
God's Messenger entered the Ka'ba with Usama b. Zaid, ‘Uthman b. Talha al-Hajabi, and Bilal b. Rabah, and locking it behind him, he remained inside. I asked Bilal when he came out what God's Messenger had done, and he said, “He took up a position with one pillar on his left, two on his right, and three behind him (the House at that time having six pillars), then performed salat.”
Ibn ‘Abbas said that when the Prophet entered the House (the Ka’ba) he made supplications in all sides of it, but did not perform salat till he had come out. When he came out he prayed two rak'as facing the Ka'ba and said, “This is the qibla.”
Bukhari transmitted it and Muslim transmitted it from Ibn ‘Abbas from Usama b. Zaid.