Shaykh Abdul Azeez ibn Baaz rahimahullaah was asked the following question:
Q: Is it correct that magic can be cured with magic? I hope that you will benefit us, may Allaah reward you with good.
A: In the name of Allaah, the Most Beneficent, the Most Merciful.
All praise is for Allaah, and may His Peace and Blessings be upon the Messenger of Allaah, and upon his family, his companions, and whoever follows his guidance.
Then to proceed:
Magic is not to be cured with magic, because magic is not carried out except by worship of the devils, and calling upon them besides Allaah, and by seeking nearness to them with the (various) types of worship; and (because) magic is from the greatest of forbidden things, rather it is from the forbidden things that contain polytheism (Shirk).
So it is not permissible to cure magic with magic.
When the Prophet sallAllaahu `alaihi wa sallam was asked regarding ‘an-Nushrah’ (curing magic with magic, & requesting such from a magician), he said: “It is from the work of the devil.”
[Reported by Ahmad 3/294, and Abu Daawood no. 3868, and graded as ‘Saheeh’, authentic by Shaykh al-Albaanee rahimahullaah]
And this is the ‘Nushrah’ (curing magic with magic) that the people of the times of ignorance would practice.
So it is not permissible to cure magic with magic; rather what is obligatory is that it is cured by another means, (it is to be cured) with the legislated ‘ruqyah’ (by reading over the afflicted with verses from the Noble Quran, and with the prescribed supplications), and (it is to be cured) with the medicines that have been prescribed by the legislation – this is what the people of knowledge have mentioned.
And it is never allowed to cure magic with magic, as it (magic) contains seeking nearness to the devils and worship of them; and it is something that causes the displeasure of Allaah – the Exalted & Most High.
[Source: http://www.binbaz.org.sa/mat/9884 ]