the magic word and the way you spell it are the same gamble
means To name the letters of a word in their correct order, or — quite separately — a set of words spoken to work magic, and also a short stretch of time or a turn at doing something.
from English fused several near-identical-looking words here. The 'magic words' sense comes from Old English 'spell,' meaning a tale, saying, or message — the same root that hides inside 'gospel' (literally 'good spell,' good news). The 'spell out letters' sense arrived later through Old French 'espeller,' 'to read out letter by letter,' itself borrowed from a Germanic cousin of that same old 'spell.' The 'a spell of rest' sense is a different beast entirely, from a Germanic root meaning to substitute or take a turn, related to 'to relieve someone at work.' Three threads, one spelling — which is exactly the gamble.