A little doubt often creeps in when using an indefinite article (a/an) before an acronym or an initialism. Firstly, let’s just quickly distinguish between these two.
An acronym is an abbreviation from the initial letters of other words and then pronounced as a word. For example: NASA, SCUBA, RADAR, UNICEF, NATO.
An initialism, while also an abbreviation from the initial letters of other words, cannot be pronounced as a word. Each letter has to be pronounced separately, eg BBC, FBI, RSVP, VIP.
So, which indefinite article precedes these ‘words’?
With acronyms, since they are pronounced as words, they’re treated like any other consonant or vowel-starting word:
A NASA official
A NATO report
An OPEC meeting
With initialisms, however, the indefinite article is determined by the sound of the first letter of the ‘word’:
A BBC spokesman
A VIP lounge
F (eff), H (aitch), L (ell), M (em), N (en), S (ess) X (ex), are consonants but are vowel-sounding. So any initialism starting with those letters is preceded by ‘an’.
An FBI agent
An SOS call
An MA in languages
An X-ray fish
Don’t forget ‘U’, although a vowel, is, in these circumstances, treated as a consonant, as it’s pronounced ‘You’.
A UNESCO official
A UFO but An Unidentified Foreign Object
You will probably find yourself using the right articles without even realising you’re doing so. I hope this helps explain why you’re doing it correctly!