Use of a or an are not determined by spelling, but pronunciation. any word which sounds like it begins with a viwel (may or may not actually begin with a vowel) will take an. and any word whihc begins with sound of a consonant will take 'a' as preceding article.
E.g.
user,university both begin with sound of 'yu..' Hence, 'a' is the article used for them.
hour begins with a consonant, but we always say 'an hour' why? because the first sound when the word hour is pronounced is 'aww.' sound of a vowel.
I hope this makes it clear.. you can consider many other examples.. 'a one-day match' is correct, not 'an one-day match', reason being while one begins with a vowel, the sound is that of a consonant - w.