All perfect praise be to Allaah, The Lord of the Worlds. I testify that there is none worthy of worship except Allaah, and that Muhammad is His slave and Messenger.
The difference between magic and miracles is so clear that nobody should be confused between them. A miracle is any act that is supernatural. Fakhrud-Deen Ar-Raazi defines it as “Anything that is supernatural and which is challenging without being contradictory in itself.” If you look at the miracles of Prophet Muhammad you find that some of them represented a challenge like the Quran while others did not represent a challenge like the fact that water flowed from between his fingers.
The miracles of Prophet Muhammad were various and numerous. Ibn Taymiyyah says in his book “The Right Answer”,
"The miracles and evidences that prove the prophecy of Prophet Muhammad are various and numerous. In fact they are greater and more numerous that the miracles of the other Messengers of Allaah. They are called the miracles or the signs of prophecy, and the most important and indeed the most challenging of all these miracles is the Holy Quran which was revealed to Prophet Muhammad and which is used to worship Allaah. In fact, any chapter of the Quran represents a great challenge to all human beings and Jinns.
“One of the Prophet's miracles is his informing about the previous prophets and their nations. Also, his informing about facts concerning the Lord, the Angel, Paradise, Hell and other things from the Unseen, although he was illiterate. The Prophet also informed about future events like: the Muslim Ummah's triumph, the extinction of the Persian and the Roman empires etc. Also, among his miracles is the ability to influence and act miraculously like the splitting of the moon to support him and the flowing of water between his fingers…"
Ibn Taymiyyah adds that the nature of miracles is beyond the ability of humans or animals whereas the acts of magicians and sorcerers do not go beyond the nature of the acts of animals and the Jinns. A magician may treat some sick people, or sometimes fly on a bird or on a Jinn from one place to another. However, creatures like birds are also known to fly. A magician might produce some food or clothes or other objects [out of thin air]. In this case, objects are simply transferred from a given place to another one; humans as well as the Jinns can do this. However, the Jinns do it in a covert way so that we do not perceive it.
Nevertheless, these actions are not the same as water flowing from between the fingers abundantly, which cannot be done by any human being or any Jinn. In fact, the Prophet performed this miracle when he put his hand in a receptacle and water started to flow from his fingers like springs.
There is a difference between the knowledge of the matters of the Unseen that Allaah The Almighty gives His prophets and orders them to inform their people, and what the magicians and sorcerers tell their audience. The latter is something that could be common knowledge whereas the former is miraculous, like telling people what they eat and what they store as Prophet 'Eesa did to the Banu Israa'eel.
On the other hand, when the Jinns inform magicians or soothsayers about some events of the Unseen, they add or deduce some information that they overhear from the Heavens. They do not have enough power to get accurate information. Whereas the prophets inform about future events with accurate precision as narrated in Al-Bukhari and Muslim that the Prophet said: "The Hour will not be established till you fight a nation wearing hairy shoes, and till you fight the Turks, who will have small eyes, red faces and flat noses; and their faces will be like flat shields. And you will find that the best people are those who hate responsibility of ruling most of all till they are chosen to be the rulers. And the people are of different natures: The best in the pre-Islamic period are the best in Islam. A time will come when any of you will love to see me rather than to have his family and property doubled." Some of these events have happened exactly as they were described.
It is known that the Prophet was sent to both humans and the Jinns. Thus, his miracles have to be beyond the scope of both. Prophet Sulaymaan (Solomon) was able to direct the wind as he wished.
Magic is of two kinds as related by Az-Zuhri . The first kind is using tricks and jugglery, making people believe in some unusual things. The second kind has some influence on the body and it is related in the Quran as Allaah The Almighty Says (what means):
The greatest miracle that was given to Prophet Muhammad is the Quran. It is a challenge from Allaah The Almighty to all human beings and Jinns until the Day of Judgment. No human being or Jinn will be able to make a chapter like the verses of the Quran. In fact it is the Word of Allaah The Almighty. It comes from Him and it goes back to Him. It is not poetry or magic, and it is not like the words of any human being. Thus, whoever claims that it is magic, Allaah The Almighty challenges him and Says (what means): {That this is verily the word of an honored Messenger [i.e. Jibreel (Gabriel) or Muhammad which he has brought from Allaah]. It is not the word of a poet, little is that you believe! Nor is it the word of a soothsayer (or a foreteller), little is that you remember! This is the Revelation sent down from the Lord of the 'Aalameen (mankind, Jinns and all that exists).} [Quran 69:40-43]
Among the verses that prove that Allaah The Almighty supported His Prophet, sallallaahu ‘alayhi wa sallam, with miracles are: Allaah The Almighty Says (what means):
There are many books in Arabic concerning this subject. The book “Awliyaa’ ur-Rahmaan wa Awliyaa’ ush-Shaytaan" written by Ibn Taymiyyah has been translated in English. It is an outstanding book on the subject and we strongly recommend you to read it.
Allaah Knows best.