Think turn of the 20th-century Vienna. Think the last flowering of Habsburg imperial certainties. Then think of the darker, doomed currents surging just beneath its surface. Now think artistic creativity. Think music, and the chances are, a century on, that the first person you think of is Gustav Mahler.

And there, in a nutshell, we have Hugo Wolf's problem. The living Mahler was Wolf's nemesis when they both inhabited the fiercely competitive artistic world of fin de siecle Vienna. And the dead Mahler still haunts Wolf's reputation now, days before the centenary of Wolf's own death. While Mahler's extraordinary symphonies fill the largest halls, Wolf's no less extraordinary songs still belong mainly to the connoisseur.

Almost none of this was, or is, Mahler's fault. But Mahler and Wolf made the same career at the same time in the same place. Their lives intersected at many key moments and their reputations have danced in a kind of extended counterpoint ever since. But it is Mahler who won the prizes, then and now. And that, then and now, is Wolf's tragedy.

Mahler and Wolf were almost exact contemporaries, born just four months apart in 1860. They came from similar modest social backgrounds in the provinces of the Austrian empire - Mahler's in Bohemia, Wolf's in Styria. Artistically, their lives were both formed by the influence of Wagner.

Their early careers marched in lock-step. Both arrived in Vienna in 1875 and enrolled in the Vienna Conservatoire at the precocious age of 15. Both studied harmony in the same class. Mahler lasted longer than the always impatient and disrespectful Wolf but, even after Wolf's expulsion in 1877, the two remained close.

By 1879, Mahler and Wolf were sharing a garret, along with Mahler's friend Rudolf Krzyzanowski, in a classic Viennese La Bohème existence. They wrote their earliest music in one another's company. They scrabbled pennies from teaching to attend the opera together. Mahler and Wolf are even said to have shared a bed, though there is no suggestion of a sexual relationship. But it was probably at around this time that Wolf contracted the syphilis that was eventually to kill him.

Within a year, though, Mahler and Wolf drifted apart. Mahler left Vienna to pursue his conducting career. Wolf stayed, turning to music criticism for a living. Away from one another, the two each matured as composers. But it was Wolf's songs, rather than Mahler's orchestral works, that were first to win critical acclaim, both in Vienna and beyond.

Indeed, by the time Mahler returned to Vienna in 1897 to take up the most prestigious post in Viennese music, director of the Court Opera, Wolf was probably the better known composer. But Wolf's composing career was already at an end. His last completed songs date from March 1897, and, although he continued to work on his unfinished opera Manuel Venegas, his body and mind were on the verge of collapse. And it was Mahler who triggered it.

Mahler's appointment to the opera had fired Wolf's hopes that his opera Der Corregidor would now at last receive a performance of which Wolf was convinced it was worthy. He went to see Mahler to press his case. Their meetings were friendly. Mahler showed some interest, though whether it was as much interest as Wolf immediately assumed is unclear.

What is clear, though, is that Wolf's visit to Mahler in his office at the opera in May 1897 was the breaking point for Wolf's sanity. Seeing the score of Anton Rubinstein's opera The Demon on Mahler's desk, Wolf became angry. He denounced Rubinstein's work. Mahler responded with some critical comments about Der Corregidor, and expressed doubts about whether it would be performed in Vienna. This argument was, as Wolf's biographer Frank Walker calls it, "the spark that had kindled a conflagration in his brain and brought on the long threatened insanity".

Wolf began to tell people in his circle that he, not Mahler, had been appointed as director of the Vienna Opera. The delusion rapidly became obsessive. Some stories have Wolf standing on the Ringstrasse proclaiming himself the rightful director to passing pedestrians. On one occasion, Wolf gathered his friends together and walked at high speed to the house of the singer Hermann Winkelmann, ordering Winkelmann to come and rehearse Manuel Venegas. The next day, playing his new opera to his friends at the piano, Wolf announced that he would fire both Mahler and Winkelmann.

By the end of the year, Wolf was in an asylum. A brief respite in 1898 - during which he visited Trieste, where for the first and only time in his life he saw the sea - proved illusory. In October that year he tried to drown himself and was found huddled and soaking in a nearby wood. Wolf was returned to an asylum in the Vienna suburbs. His memory began to fail. His delusions grew worse. In early 1900 he began to suffer severe paralysis. After a long series of terrible illnesses and great suffering, he died on February 22 1903, a victim of what the Victorians called "the wound that will never heal".

Wolf's death was one of the most protracted, miserable and bitter in the history of music. But, even in the poignancy of his death, Wolf has been transcended by Mahler. To the 20th century, it is Mahler's incurable illness - the cancer from which he died in Vienna in 1911 - that has become the emblem of Viennese corruption and decline, the stuff of legend, of sentiment and of the big screen treatment.

It is, of course, a false rivalry. But it is historically important, if nothing else, to realise that what we tend to think of as Mahler's Vienna can, in a very real sense, be more truly described as Wolf's Vienna. Wolf was the archetype. If you are looking for a great doomed Viennese composer, a great dark emotional spirit, a man living out his life in the shadow of the disease that would kill him in a world that would outlive him only by a handful of years, then Wolf is just as much your man as Mahler.

Wolf's death certainly spoke powerfully to the Vienna of his time. In a move that would have surprised but pleased him, he was allocated a so-called "grave of honour" in Vienna's central cemetery, only yards away from Beethoven and Schubert. Streets were named after him. Memorial tablets were unveiled to him. Wolf's death also triggered an immense outburst of performances of his music. Even Der Corregidor was widely performed for a while. Most significantly of all, singers began to include his work regularly in their recitals. In the year of his death, Wolf's surviving relatives were able to sell the copyright on his music to Peters for 260,000 marks, a considerable sum.

If Wolf lives on somewhat in Mahler's shadow today, this is perhaps in part because the form that he made his own - the song - no longer occupies the central place in music-making that it did in Wolf's own lifetime and in the pre-1914 Germanic cultural tradition. Today, audiences prefer big statements, cathartic effects and emotional exhibitionism. Thanks to the stereo, they can now accommodate such displays in their own living rooms, in their cars, and even in their headsets.

Yet it would be the greatest insult of all to Wolf to imagine, because he was a minituarist and not a big-canvas man, that he was anything less than a completely intense artist. No one, not Chopin, not Webern, put more into such small forms as he did. Auch kleine Dinge - also little things, as the first line of the first song of the Italian Songbook puts it - can express the rigorous truths that Wolf saw as the great principle of his art. You can be as wrung out and haunted by a performance of a song like Ganymed as you can by a performance of Das Lied von der Erde. In the 1930s, Walter Legge tried to capture Wolf's work on disc, prompting his wife Elisabeth Schwarzkopf to call him "the best thing that ever happened to Hugo Wolf" - though some would say that she deserved that accolade. "The first and last requisite in the performance of Wolf," wrote Legge, "is vividness of imagination, freedom from the silly delusion that music is a gentlemanly calling, complete lack of our natural racial inhibition about the fear of showing one's emotions in public. Wolf was a man who suffered. For the interpreter then to do justice to Wolf he must cast off the shackles of repression and live in an intellectual and emotional world, keener, more alive, more vital, more impassioned than his everyday life. He must transplant himself into a new world and a new world for every song."

Of which new worlds there are more than 200.

· The Hugo Wolf series at the Wigmore Hall, London W1, continues until February 24. Box office: 020-7935 2141.