Susana is right, up to a point, that we use 'a' before words that begin with consonants ( b, c, d, f, g and so on) and 'an' before words that begin with a vowel (a, e, i, o, and u) .
But it isn't quite that simple.
The important thing to remember is that this is a rule about the SOUND of words, not the spelling.
So there are some exceptions to the simple vowel/consonant rule:
1. We use 'an' before words which begin with silent consonants : for example, 'an hour' and 'an honour'.
2. We use 'an' before certain letters and numbers which are pronounced with initial vowel sounds: for example 'an MBA' 'an FBI agent' 'an 18-year-old girl'.
3. We use 'a' before words beginning with vowels that are pronounced like the consonant 'y': for example 'a euro' 'a university'