It's not determined by what the beginning of the word looks like on the page but what it sounds like. The beginning of the word "hour" sounds like a vowel sound so it must be preceded by "an".
The same rule applies to abbreviations like MP (an MP)or or a word like X-ray (an X-ray).
