Last years and masterworks
Despite his preoccupation with the stage and subsequent official duties, Schubert wrote a significant amount of music during these years. He completed the Mass in A♭ major, (D. 678) in 1822, and later that year embarked suddenly on a work which, more decisively than almost any other in those years, showed his maturing personal vision, the Symphony in B minor, known as the Unfinished Symphony (D. 759). The reason he left it unfinished – after writing two movements and sketches some way into a third – continues to be discussed and written about, and it is also remarkable that he did not mention it to any of his friends, even though, as Brian Newbould notes, he must have felt thrilled by what he was achieving.
In 1823, Schubert wrote his first large-scale song cycle, Die schöne Müllerin (D. 795), setting poems by Wilhelm Müller. This work, together with the later cycle Winterreise (D. 911, also setting texts of Müller in 1827) is widely considered one of the pinnacles of Lieder. He also composed the song Du bist die Ruh' (You are rest and peace, D. 776) during this year. Also in that year, symptoms of syphilis first appeared.
In 1824, he composed the Variations in E minor for flute and piano based on Trockne Blumen—a song from Die schöne Müllerin—as well as several string quartets. He also wrote the Sonata in A minor for arpeggione and piano (D. 821) at a time when there was a minor craze over that instrument. In the spring of that year, he wrote the Octet in F major (D. 803) and a sketch for a "Grand Symphony," and in the summer went back to Zseliz. There, he became attracted to Hungarian musical idioms and wrote the Divertissement à la hongroise in G minor for piano duet (D. 818) and the String Quartet in A minor Rosamunde (D. 804). It has been said that he held a hopeless passion for his pupil, the Countess Caroline Esterházy, but the only work that bears a dedication to her is his Fantasia in F minor for piano duet (D. 940). This dedication, however, can only be found in the first edition and not in Schubert's autograph. His friend Eduard von Bauernfeld penned the following verse, which appears to reference Schubert's unrequited sentiments:
The setbacks of previous years were compensated by the prosperity and happiness of 1825. Publication had been moving more rapidly, the stress of poverty was for a time lightened, and in the summer he had a pleasant holiday in Upper Austria where he was welcomed with enthusiasm. It was during this tour that he produced the seven-song cycle Fräulein am See, based on Walter Scott's The Lady of the Lake, and including "Ellens Gesang III" ("Hymn to the Virgin") (D. 839, Op. 52, No. 6); the lyrics of Adam Storck's German translation of the Scott poem are now frequently replaced by the full text of the traditional Roman Catholic prayer Hail Mary (Ave Maria in Latin), but for which the Schubert melody is not an original setting. The original only opens with the greeting "Ave Maria", which also recurs only in the refrain. In 1825, Schubert also wrote the Piano Sonata in A minor (D. 845, first published as op. 42), and began the Symphony in C major (Great C major, D. 944), which was completed the following year.
From 1826 to 1828, Schubert resided continuously in Vienna, except for a brief visit to Graz, Austria, in 1827. In 1826, he dedicated a symphony (D. 944, that later came to be known as the Great C major) to the Gesellschaft der Musikfreunde and received an honorarium in return. The String Quartet No. 14 in D minor (D. 810), with the variations on Death and the Maiden, was written during the winter of 1825–1826, and first performed on 25 January 1826. Later in the year came the String Quartet No. 15 in G major, (D. 887, first published as op. 161), the Rondo in B minor for violin and piano (D. 895), Rondeau brillant, and the Piano Sonata in G major, (D. 894, first published as Fantasie in G, op. 78). He also produced in 1826 three Shakespearean songs, of which "Ständchen" (D. 889) and "An Sylvia" (D. 891) were allegedly written on the same day; the former composed at a tavern where he broke his afternoon's walk, the latter on his return to his lodging in the evening.
The works of his last two years reveal a composer entering a new professional and compositional stage. Although parts of Schubert's personality were influenced by his friends, he nurtured an intensely personal dimension in solitude; it was out of this dimension that he wrote his greatest music. The death of Beethoven affected Schubert deeply, and may have motivated Schubert to reach new artistic peaks. In 1827, Schubert wrote the song cycle Winterreise (D. 911), the Fantasy in C major for violin and piano (D. 934, first published as op. post. 159), the Impromptus (D. 899 and D. 935, two sets of four pieces in which the latter was published posthumously) for piano, and the two piano trios (the first in B♭ major (D. 898), and the second in E♭ major, (D. 929); in 1828 the cantata Mirjams Siegesgesang (Victory Song of Miriam, D. 942) on a text by Franz Grillparzer, the Mass in E♭ major (D. 950), the Tantum Ergo (D. 962) in the same key, the String Quintet in C major (D. 956), the second "Benedictus" to the Mass in C major (D. 961), the three final piano sonatas (D. 958, D. 959, and D. 960), and the collection 13 Lieder nach Gedichten von Rellstab und Heine for voice and piano, also known as Schwanengesang (Swan-song, D. 957). (This collection – which includes settings of words by Heinrich Heine, Ludwig Rellstab, and Johann Gabriel Seidl — is not a true song cycle like Die schöne Müllerin or Winterreise, as its songs were collected posthumously – Schubert might not have intended it as a song cycle.) The Great C major symphony is dated 1828, but Schubert scholars believe that it was largely written in 1825–1826 (being referred to while he was on holiday at Gastein in 1825—that work, once considered lost, is now generally seen as an early stage of his C major symphony) and was revised for prospective performance in 1828. The orchestra of the Gesellschaft reportedly read through the symphony at a rehearsal, but never scheduled a public performance of it. The reasons continue to be unknown, although the difficulty of the symphony is a possible explanation. In the last weeks of his life, he began to sketch three movements for a new Symphony in D major (D. 936A); In this work, he anticipates Gustav Mahler's use of folksong-like harmonics and bare soundscapes. Schubert expressed the wish, were he to survive his final illness, to further develop his knowledge of harmony and counterpoint, and had actually made appointments for lessons with the counterpoint master Simon Sechter.
On 26 March 1828, the anniversary of Beethoven's death, Schubert gave, for the only time in his career, a public concert of his own works. The concert was a success popularly and financially, although it was overshadowed by Niccolò Paganini's first appearances in Vienna shortly after.