In 1701 he was appointed organist and composer of the vice-regal court at Naples, where his father was "maestro di cappella". The following year he took leave of absence and travelled with the family to Florence where Alessandro hoped for employment from Prince Ferdinando de' Medici. When this was not forthcoming Domenico returned to Naples, where he tried his hand at opera before his father removed him in 1705 and sent him to Venice to try his luck there. It may have been in Venice that he first met Handel, with whom he formed a strong attachment. (Another friendship made in Italy was with Thomas Roseingrave, who later championed Scarlatti's music in England and Ireland.) By 1707, however, Scarlatti was in Rome, assisting his father at San Maria Maggiore, and he remained in Rome for over 12 years, occupying posts as "maestro" to the dowager Queen of Poland from 1711, to the Marquis de Fontes from 1714, and at St. Peter's (assistant "maestro" of the Cappella Giulia from November 1713, "maestro" from December 1714). He thus provided music for both sacred and secular employers, but he was unable to free himself from a domineering father until he obtained legal independence in January 1717.
In 1719 Scarlatti resigned his positions in Rome and apparently spent some years in Palermo before taking up his next post, as "mestre" of the Portuguese court in Lisbon. The Lisbon earthquake of 1755 destroyed documents about his career there, but his duties included giving keyboard lessons to John V's daughter, Maria Barbara, and his younger brother, Don Antonio. When Maria Barbara married the Spanish crown prince in 1729 Scarlatti followed her to Seville and then, in 1733, to Madrid, where he spent the rest of his life. Although he continued to write vocal music, sacred and secular, the main works of his Iberian years are the remarkable series of keyboard sonatas, copied out in his last years and taken to Italy by his colleague, the castrato Farinelli.
Scarlatti married twice: in 1728 a Roman, Maria Catarina Gentili, and in 1739 a Spaniard, Anastasia Maxarti Ximenes. None of his nine children became a musician. In 1738 he was honoured with a knighthood from King John V of Portugal, to which he responded by dedicating to the king a volume of "Essercizi per gravicembalo", the only music published during his lifetime under his supervision.
The seven operas Scarlatti wrote in Rome for Queen Maria Casimira were by no means failures, and his church music and secular cantatas contain much admirable music. But his fame rightly rests on the hundreds of keyboard sonatas, nearly all in the same binary form, in which he gave free rein to his imagination, stimulated by the new sounds, sights and customs of Iberia and by the astonishing gifts of his royal pupil and patron. In these he explored new worlds of virtuoso technique, putting to new musical ends such devices as hand-crossing, rapidly repeated notes, wide leaps in both hands and countless other means of achieving a devastating brilliance of effect.