Scarlatti was born in Palermo. At that time it was part of the Kingdom of Sicily. We know nothing about his musical education. When his opera "Gli Equivoci nell sembiante" was produced in Rome in 1679 the Queen of Sweden, who was living in Rome at the time, was very impressed and gave him the job of being her Maestro di cappella. In February 1684 he became Maestro di Cappella to the viceroy of Naples. He wrote many operas for him, as well as some music for important state occasions.