As modern readers of the Bible, it is easy to forget that the Bible is a product of the ancient world where magic was as much a part of religious culture as sacrifices, and temples, and myths about the many gods.
The Bible doesn't give us any magical spells, but we can understand a little bit of the larger religious culture of the ancient Near East by looking at the many texts found at Ugarit -- a city north of Israel that was destroyed around 1200 BCE.
For example, KTU 1.169 is a magical incantation of some sort. It relates generally to the biblical world through connections with the magical practices of the ancient Near Eastern culture described in the Bible, through connections of poetic or figurative language of the Bible, and through the formulaic language of religious curses found in the Bible.
The difficulties involved in interpretation of this text have generated many articles but no consensus on what it’s about. The problems fall into two categories—either, issues with otherwise attested words whose meaning can be determined but whose function here is difficult to determine, or issues with words that are only attested here in this text (and it has a lot for a short tablet) so no one is quite sure either what they mean or how they’re being used.
There are 3 options for understanding the purpose of this text:
1) It is an incantation against sexual impotence (Saracino, Pardee)
2) It is an incantation for casting out demons/ghosts/evil spirits who cause disease (Avishur)
3) It is an incantation against sorcery (Fleming)
While it seems to be a stretch to identify the affliction of the priest’s client as sexual impotence, the likelihood is high that a physical illness or condition of some kind prompted the consultation with the priest. The belief that diseases were caused by evil spirits was common in the ancient world (Avishur 1981, 14).
Avishur (1981:14-16) interprets the incantation progressively in a way that incorporates the two remaining options – first it is an incantation against evil spirits who cause disease, then against the magicians who invoked the evil spirits to inflict disease. The first strophe is against the spirits directly. The second strophe is against the magicians. Fleming and Ford both treat this as just an incantation against the sorcerers based on the direct address to the sorcerer in line 9. However, it makes sense to consider both the sorcerer and the supernatural power that he was perceived to control as being the object of the incantation.
While not explicitly containing any incantations, the Hebrew Bible shows a clear awareness of the practice of ritual magic in Israel and the surrounding cultures of the ancient Near East. Joseph was able to interpret the dreams of Pharaoh when his magicians and wise men could not (Gen 41). Similarly, Daniel is placed over all the magicians, enchanters, and sorcerers of Babylon (Dan 5:11). In the Exodus story, Moses and Aaron trade displays of supernatural power with the magicians of Pharaoh (Exod 7-9). Balak of Moab hires Balaam to curse Israel, paying him the “fees for divination” (Num 22:7). Saul consults a medium to contact the dead spirit of Samuel (1 Sam 28:7). Leviticus and Deuteronomy legislate against the practice of magic (Lev 20:27, Deut 18:10-11). Manasseh is accused of sorcery and other magical practices that characterized his religious abominations in addition to idolatry (2 Chron 33:1-9). The prophets also present a negative view of magic, characterizing sorcery and divination as a key component of false prophecy (Isa 2:3, 19:3, 47:9-12; Ezek 13:18-21; Jer 27:9).
The act of casting out evil spirits or demons is common to the Gospels (i.e., Matt 8, Mark 6, et. al.) where it is often closely associated with healing the sick. There are no explicit incantations in the New Testament but Matthew 8:16 describes Jesus casting out spirits “with a word” and passages like Matthew 7:22 and Luke 9:49 (“we saw someone casting out demons in your name”) reflect the need to invoke the name of a powerful religious authority to give effectiveness to the banishment. The Gospels portray the name of Jesus being used to bring power to the pronouncement in the same way that the deities Baal and Horon are invoked in KTU 1.169.
In addition to the cultural connections with the practice of ritual magic, many phrases similar to those used in KTU 1.169 can be found in the Hebrew Bible.
Parallels with the similes from lines 3-4:
“like smoke from a window” Hosea 13:3
“like a goat to the mountain” 1 Sam 24:3
“like a lion to the lair” Jer 25:38 & Ps 10:9
It is interesting to note that the image, not the exact phrasing, is important. Many of the parallels use close synonyms, not the exact words, which indicates this is stock imagery but not stock formulaic language.
One final observation related to biblical language is that the calling down of curses as punishment as found in lines 6-8 is reminiscent of Lev 26 and Deut 28 and the invocation of curses as punishment for breaking the covenant. The curse language from those passages is itself part of the stock imagery of the ancient Near East as has been demonstrated through comparisons with ANE treaty language such as that found in the vassal treaties of Esarhaddon and the Aramaic treaty from Sefire.
Avishur, Y. 1981. The ghost-expelling incantation from Ugarit. UF 13:13-25. Fleming, D. 1991. The voice of the Ugaritic incantation priest (RIH 78/20), UF 23: 141-154. ---. 2002. Ugaritic incantation against sorcery (RIH 78/20). In The Context of Scripture. Vol. III: Archival Documents from the Biblical World. Eds. William K. Hallo and K. Lawson Younger. Leiden: Brill. Ford, J.N. 2002. The Ugaritic incantation against sorcery: RIH 78/20 (KTU2 1.169). UF 34: 153-211. Saracino, Francesco. 1982. Ras Ibn Hani 78/20 and some Old Testament connections. VT 32/3: 338-343.
 The “sexual impotence” interpretation seems to rest solely on the use of the word “rod, staff” to be a euphemism for “penis.” The connection seems rather weak without further evidence.