When the x is before the stressed vowel, we pronounce it as a voiced sound /gz/. For example, pronounce /gz/ in the words example /ɪgˈzæmpəl/ and exactly /ɪgˈzæktli/.
Least common are words which begin with letter x, such as xenophobe or xylophone. In these words, pronounce /z/ for the letter x.
Note, some foreign loan words in English have a different pronunciation of the letter x. For example, the French loan word faux is pronounced with a silent x (/foʊ/).
Below are a list of words you might commonly use which contain the letter x, sorted by their pronunciation (voiceless /ks/ and voiced /gz/). Also included are consonant clusters with xt. These are pronounced /kst/.
x at the end of a word or after a stressed vowel: /ks/
six, sixteen, sixty
x before a stressed vowel: /gz/
exert, exerts, exertion
exhaust, exhausting, exhaustion
clusters with xt and xts: /kst/ /ksts/
text, texts /tɛkst/ /tɛksts/
extend, extended, overextend