Spanish does have a few exceptions, mainly due to loanwords from indigenous American languages. For example, it would not be possible to guess that the X in México is pronounced like Spanish J.
You do not guess, you learn.
You do not guess, you learn.