It can however be defeated with sufficiently advanced science.
The planet Prysmos was a world where magic ruled and science was held in disdain. As time progressed however, the Prysmosians developed increasingly advanced technology that rendered magic all but obsolete. The only known wizard to survive into the "Age of Science" was the extremely powerful and technophobic wizard Merklynn who wished to be respected once again. To that end he schemed to create the Trinary Re-Alignment that caused Prysmos to revert to a feudal and arcane state. Merklynn had been hasty in crafting his spell however and Prysmos' three suns drifted out of alignment, unleashing gravitational forces powerful enough to rip the planet to shreds. The survivors fled into space with Merklynn making his way to the planet Earth where he used his magic to disguise himself as "Garrison Kreiger".
By the modern era, the galaxy largely dismissed magic in favour of technology with the notable exception of the Dire Wraiths. The Wraith Sorcerers could use their magic to perform a variety of feats such as teleportation, telepathy, and the ability to conjure forcefields. Their magic allowed them to infect and assimilate other lifeforms allowing them to assume their form.
A mysterious ore of unknown origin enhanced the natural magic of the Dire Wraiths and they invaded Elonia to try and obtain it despite it being lethal to them. Their invasion was unsuccessful and resulted in the birth of the Space Knights. After the Dire Wraiths had gone to war with the Solstar Order, their science proved superior to the Wraiths' dark magic. Decades afterwards, another group of Wraiths discovered Ore-13 on the planet Earth that had near-identical effects on Wraith magic as the Elonian ore. Its enhancing effect was such that the Wraiths could conceal themselves from a Knight's Energy Analyzer.
In the mid-19th century, a Wraith Soldier attempted to assimilate the Autobot Sky Blast, the fusion of Wraith magic and Cybertronian biology turned both the Wraith and the Autobot into an out of control Wraith/Cybertronian hybrid. Once the hybrid's energies caused it to combust, Vekktral wondered if Wraith magic might work better on mechanicals of similar stature to the Wraiths. By studying the hybrid's remains however, Vekktral learned how to stabilize the fusion of Wraith magic and Cybertronian biology and managed to assimilate Ultra Magnus. Despite this, the vast majority of Wraiths were far too disgusted by the mechanical physiology of the Cybertronians to attempt further assimilations.
In World War II, Kreiger and Sgt. Savage made the acquaintance of the lost Eukarian Centurion and aided him in returning to his ship. When the three arrived at the ruins of the craft, Kreiger noticed the ident on the bridge where the mysterious Talisman had once been and correctly deduced it to be a magical artifact. After an IRON Trooper attack caused the Axalon to teleport away, Kreiger devoted his life to finding the Talisman so as to use its magic to recreate his lost homeworld.
Human science fiction author Arthur C. Clarke wrote that "any sufficiently advanced technology is indistinguishable from magic". Joe Colton dismissed magic as unexplained science prompting Kreiger to quote Clarke's third law as the two discussed the arcane and the Talisman. In reality, Kreiger was trying to turn Colton away from technology and towards magic which he regarded as the true power of the universe but he quickly gave up on this as a lost cause.
After the humans became more aware of the Dire Wraiths, they published several texts regarding magic on the internet. When the command staff of both G.I. Joe and Autobot City were occupied on Cybertron, the Wraiths sought to consolidate their power over Earth and used their magic to alter the biology of several insects, turning them into carriers of a virus. The magic was so unstable however that it burned through the organic hosts.
There was no magic in Microspace leaving the Micronauts unprepared for it when they confronted a duo of Wraith Sorcerers. To thwart the Wraiths' plans, the Micronauts sought out Rom for his expertise on the arcane.
After encountering the Wraiths' magic however, Larissa was able to adjust the personal forcefields of the Micronauts to resist magic. When Rom and the Micronauts confronted the Dire Wraiths and their virus, the magic infused in the latter afforded it a crude sentience. Nonetheless Biotron was able to use technology to synthesize an antidote to the virus. When Baron Karza proposed an alliance to D'rge, his personal forcefields were also calibrated against magic.
On Cybertron, the Iron Ring encountered fierce resistance from Optimus Prime and Scarlett's group as well as the Council of Worlds. In light of this, Kreiger chose to forgo their objective of reaching the metallic planet's core and activate the Talisman then and there. Using his magic he manipulated the planet's energon reserves to transform a portion of the planet's underground into New Prysmos which he claimed would be the staging ground for bringing about the "Age of Magic" across the galaxy.
After the Velocitronian Breakdown had been injured by the magical energies of the Talisman, Cindarr realized the Cybertronian vulnerability to magic and shared this information with Virulina who used hers to kill Kup as a show of power.
After cementing their alliance, the Absence and D'rge used their magic to alter Baron Karza's enerchanging abilities. The Micronauts had further upgraded their shields against magic allowing them to counter D'rge's attacks.