click once on the spell (left), then chose the 'cast' button on the right side of the spellbook. the gui is extremely inefficient as I and others have pointed out a few times, but all the suggestions have been ignored so far..
doubleclicking does indeed select the spell directly but also selects a target (directly under your mousepointer), thus the warnings about invalid targets. right clicking does nothing, except when you're already targeting a spell (your mousepointer changes its icon to a wand), in that case right-click aborts the targeting.