Autocast is an option controlled via your spellbook or action bar, if the spell has been dragged to your bar. In your spellbook, "Autocast" is the default option (left-click) for combat spells, with "Cast" as an alternate option (right-click). Non-combat spells, and combat spells such as curses and Vengeance, do not have an autocast option. All spells placed on an action bar have cast as their default action, but combat spells have an additional right-click autocast option.
Once an autocast spell has been selected, a player will continue casting this spell as their default attack as long as have sufficient runes.
When you are dual-wielding magic weapons, you can select if you want to auto-cast a spell for the mainhaind or for the off-hand when clicking auto-cast in the spellbook.
Originally, a staff was required to autocast a spell. When wielded, the combat style tab would present you with an autocast spellbook button to press with only the combat spells of your spellbook shown.
After an update on 2 September 2009, staves were no longer needed in order to autocast spells. Instead, magical items such as Ahrim's staff, Master wand, Void Knight mace, Zuriel's staff, Corrupt Zuriel's staff and Ancient staff received a 10% magic damage bonus.
Even after the update, Teleportation, Alchemy, Curses, Enchantment spells and Lunar Spells cannot be autocasted due to the potential for "away from keyboard" training. Also, when you boost your magic for a specific spell, you cannot autocast it. This may be a glitch.