Abu Dharr reported,

I asked, "Messenger of Allah, which mosque was established on earth first?"He replied, "The Sacred Mosque."I asked, "Then which?"He said, "The Aqsa Mosque."I asked, "How long was between them?"He said, "Forty years. And wherever you find yourself when the time for prayer comes, pray there, for it is a mosque."

Azami 12082

Sahih

عن أبي ذر قال

قلت: يا رسول الله! أي مسجد وضع في الأرض أول؟ قال: المسجد الحرام قلت: ثم أي؟ قال: المسجد الأقصى قلت: كم بينهما؟ قال: أربعون سنة، وأينما أدركتك الصلاة فصل فهو مسجد.

الأعظمي 12082صحيح
Contents
Reference
Commentary
Ayat
Collection
Jami al-Kamil
Book
Tafsir of the great Quran
Chapter
Virtues of Surah Baqarah
Section
His saying, "Indeed the first house established for mankind was that at Bakkah, blessed and a guidance for the worlds. In it are clear signs, the standing place of Ibrahim, and whoever enters it shall be safe. And pilgrimage to the House is a duty owed to Allah by mankind, for whoever is able to find a way there. And whoever disbelieves, then Allah is free of need of the worlds"
Numbering
Jami al-Kamil 12082 (2nd edition)
Azami 12082