Can I cast a spell in combat check after having rolled?
From the Rules (Page 13)


  Skill Checks / Modifiers 
  This number is added to or subtracted from the investigator’s skill value before the player makes the check. The result is the number of dice the player rolls to make the check. Note that modifiers always apply to the number of dice a player rolls for a check, not to the results of the individual dice.


A combat check is a skill check, and a spell is a modifier (with additional rules) to that check, therefore you must decide to use the spell before rolling the combat check, and you can not change your mind after the check to roll additional dice if you failed.

Thematically it makes sense as well, spells are hard to cast, require preparation and mental strengthening, so it's best to have them at the ready and in hand.