In January 1781, Mozart's opera Idomeneo, premiered with "considerable success" (New Grove) in Munich. The following March, the composer was summoned to Vienna, where his employer, Prince-Archbishop Colloredo of Salzburg, was attending the celebrations for the installation of the Emperor Joseph II. Mozart, who had just experienced success in Munich, was offended when Colloredo treated him as a mere servant, and particularly when the Archbishop forbade him to perform before the Emperor at Countess Thun's (for a fee that would have been fully half of his Salzburg salary). In May the resulting quarrel intensified: Mozart attempted to resign, and was refused. The following month, however, the delayed permission was granted, but a grossly insulting way: Mozart was dismissed literally "with a kick in the arse", administered by the Archbishop's steward, Count Arco. In the meantime, Mozart had been noticing opportunities to earn a good living in Vienna, and he chose to stay there and develop his own freelance career.
In fact, Mozart's Vienna career began very well. He performed often as a pianist, notably in a competition before the Emperor with Muzio Clementi, December 24, 1781, and according to the New Grove, he soon "had established himself as the finest keyboard player in Vienna. Mozart also prospered as a composer: during 1781–1782 he wrote the opera Die Entführung aus dem Serail ("The Abduction from the Seraglio"), which premiered July 16, 1782 and achieved a huge success. The work was soon being performed "throughout German-speaking Europe", and fully established Mozart's reputation as a composer.
Near the height of his quarrels with Archbishop Colloredo, Mozart moved in (May 1 or May 2, 1781) with the Weber family, who had moved to Vienna from Mannheim. The father, Fridolin, had died, and the Webers were now taking in lodgers to make ends meet. Aloysia, who had earlier rejected Mozart's suit, was now married to the actor Joseph Lange, and Mozart's interest shifted to the third daughter, Constanze. The couple were married, with father Leopold's "grudging consent" (New Grove), on August 4, 1782. They had six children, of whom only two survived infancy: Carl Thomas (1784–1858) and Franz Xaver Wolfgang (1791–1844; later a minor composer himself).
During 1782–1783, Mozart became closely acquainted with the work of J. S. Bach and G.F. Handel as a result of the influence of Baron Gottfried van Swieten, who owned many manuscripts of works by the Baroque masters. Mozart's study of these works led first to a number of works imitating Baroque style and later had a powerful influence on his own personal musical language, for example the fugal passages in Die Zauberflöte ("The Magic Flute"), and in the finale of Symphony No.41.
In 1783, Wolfgang and Constanze visited Wolfgang's family in Salzburg, but the visit was not a success, as Leopold and Nannerl were, at best, only polite to Constanze. However, the visit sparked the composition of one of Mozart's great liturgical pieces, the Mass in C Minor, which, though not completed, was premiered in Salzburg. Constanze sang in the premiere.
At some (unknown) time following his move to Vienna, Mozart met Joseph Haydn and the two composers became friends; see Haydn and Mozart. When Haydn visited Vienna, they sometimes played together in an impromptu string quartet. Mozart's six quartets dedicated to Haydn (K. 387, K. 421, K. 428, K. 458, K. 464, and K. 465) date from 1782–85, and are often judged to be his response to Haydn's Opus 33 set from 1781. Haydn was soon in awe of Mozart, and when he first heard the last three of Mozart's series he told the visiting Leopold, "Before God and as an honest man I tell you that your son is the greatest composer known to me either in person or by name: He has taste, and, furthermore, the most profound knowledge of composition."
During the years 1782–1785, Mozart put on a series of concerts in which he appeared as soloist in his own piano concertos. He wrote three or four concertos for each concert season, and since space in the theaters was scarce, he booked unconventional venues: a large room in the Trattnerhof, an apartment building; and the ballroom of the Mehlgrube, a restaurant. The concerts were very popular, and the works Mozart composed for them are considered among his finest. Solomon writes that during this period Mozart created "a harmonious connection between an eager composer-performer and a delighted audience, which was given the opportunity of witnessing the transformation and perfection of a major musical genre.
With the substantial money Mozart earned in his concerts and elsewhere, his family adopted a rather plush lifestyle. They moved to an expensive apartment, with a rent of 460 florins.Mozart also bought a fine fortepiano from Anton Walter for about 900 florins, and a billiard table for about 300. The Mozarts also sent their son Karl Thomas to an expensive boarding school and kept servants. These choices inhibited saving, and were the partial cause of a stressful financial situation for the Mozart family a few years later.