Spells can be used when attacking an enemy dungeons. They can also be used while defending your dungeon in Campaign mode.
Spells require a Mana Cost in order to cast them, limiting the number of times you can cast a spell and forcing you to think strategically on when and how to best utilise them. Mana can be replenished over time by tapping on the Dark Library when the potion appears over it (similar to collecting Gold / Stone). Upgrading your Dark Library will also increase the Mana storage you will have on hand for casting spells.
You will require a Dark Library before any spells can be accessed / used. After you complete the tutorial, you will get access to the Bomb Wall and Cluck Off spells.
In order to get new spells, you must upgrade the Dark Library to certain levels.