Sunan Ibn Majah 753
سنن ابن ماجه#753SahihIt was narrated that Abu Dharr Al-Ghifari said:"I said: 'O Messenger of Allah! Which mosque was built first?' He said: 'Al-Masjid Al-Haram (in Makkah).' I said: 'Then which?' He said: 'then Al-Masjid Al-Aqsa (in Jerusalem).' I said: 'How many years between them?' He said: 'Forty years, but the whole earth is a mosque for you, so pray wherever you are when the time for prayer comes
Scholarly Authentication
We show the most cautious grade (weakest-wins) as the overall label. Individual scholars graded it as follows:
Al-AlbaniSahih
Muhammad Fouad Abd al-BaqiSahih
Shuaib Al ArnautSahih
Zubair Ali ZaiSahih Muslim
In-book reference: 4:19