The Holy Prophet’s (Sallallahu alaihi wa sallam) power is not limited to this earthly world, but it holds good even in the heavenly and spiritual worlds. The way the already set sun turned back on His command, in the same way, on His command, the sun stopped its course, according to the Hadith given in Khasaais Ul Kubra on the authority of Tabarani.
Translation: “The Holy Prophet (Sallallahu alaihi wa sallam) commanded the sun and it stopped its course for 1 sa’aa (a period of time).” (Khasais Kubra, Vol 2, Pg No: 82)