Same sound, different letters
Two spellings, one sound. When English has more than one way to write a sound, the ear has nothing to choose with.
The rule
English often has several ways to write one sound: C or S for the s sound, CI or TI for the sh sound, PH or F for the f sound. A spelling that picks the other one sounds exactly right, which is why it looked right.
The s sound is the commonest case. Consensus, ecstasy, idiosyncrasy and controversy hold an S where a C would sound the same; absence, bureaucracy and criticize hold a C where an S would.
The sh sound in the middle of a word comes next: CI in malicious, precocious, tenacious and beneficial, TI in ostentatious, quintessential and negotiate.
Some cases are a single pair to learn. Peripheral takes PH, and playwright is spelled like wheelwright and shipwright, not like write.
Where it stops holding
A related word can help, and it can mislead. Malice gives malicious, with the same C. But benefit, with a T, gives beneficial with a C, which is exactly the miss in benefitial.
Which letters a word takes often follows the language it reached English through rather than anything you can hear, so a pattern that covers one family of words can fail on the next. Past the patterns above, the spelling is learned with the word.
Background
Why English has several spellings for one sound, and which layer of the language each belongs to, is on where English spelling comes from.
Try it on real words
Five words, read aloud and typed from memory with autocorrect off. About a minute, no signup.
Play today's Daily Five