Surah al-Qamar opens: "The Hour has drawn near, and the moon has split." Quran 54:1-2 continues that when the disbelievers see a sign, they turn away and say it is continuing magic. On its own the verse is compact, and Islamic tradition supplies the narrative context through hadith: companions of Muhammad, including Anas ibn Malik and Abdullah ibn Mas'ud, are recorded in Sahih al-Bukhari and Sahih Muslim describing the people of Mecca demanding a miracle from Muhammad, and the moon appearing to split into two distinct pieces, with a mountain visible between them, before rejoining.
The episode is presented in these hadith as an evidentiary miracle granted to Muhammad specifically, offered to a hostile audience that had asked for proof. Islamic theology distinguishes this kind of evidentiary miracle, granted to a prophet to confirm his message, from the different category of marvels attributed to saints, and holds that Muhammad's primary and standing miracle is the Quran itself, its language considered inimitable; the moon-splitting is presented as a secondary, physical sign alongside it. The Quran elsewhere lists such signs among the proofs offered to a resistant audience, alongside the Prophet's own recitation, and later commentators debated exactly which group of Meccans was present to witness it, without disputing that hadith transmission for the event is unusually wide.
Sources The Study Quran: A New Translation and CommentarySeyyed Hossein Nasr (editor-in-chief) with Sahih al-BukhariMuhammad al-Bukhari, Sahih MuslimMuslim ibn al-Hajjaj