From 716 to 929AD, al-Andalus was an EMIRATE. It was part of the caliphate and its capital was Cordoba. It was governed by an EMIR, who represented the caliph.
In 929AD, an emir called Abderramán III declared that al-Andalus was an independent caliphate. He established the Cordoba Caliphate. This was the beginning of a golden age for al-Andalus. Cordoba became one of the most important cities in the world.
Later on, al-Andalus was divided into small taifa kingdoms, so it was very easy to conquer them.