Muslims believe that Allah, via the Angel Gabriel, sent his last Prophet Muhammad a book, in which Allah’s will is revealed.
This book is called the Qur’an, and Muslims believe that it has been preserved perfectly.
When someone claims: “Allah said …” then this means that it is written in the Qur’an.
The messages that Allah gave to previous Prophets (from Abraham through Jesus, in the Torah, Gospels, …) were also valid initially, but according to the Qur’an (verses 2:58, 2:59, 2:75, 3:78, 4:46, 5:13, 7:161 and 7:162), these were tampered with by the Jews and Christians and hence are not reliable any more.
Is the Qur’an the only medium through which Allah made his laws known?
A muslim should also follow what Muhammad said or did.