"The day is yours - leave the night to me! "
- Spring Heeled Jack (before any of the others).
The history of shadowy pop-fiction vigilantes is ... well ... shadowy, and answering the question "who was first?" requires some careful caveats.
This article is specifically an attempt to trace the lineage of those quasi/proto-superheroes who are literally masked; who assume a colorful, themed disguise and an alternate identity. Many of them are also aristocrats in their "everyday" lives. Therefore, I'm discounting the very long tradition of culture heroes (Gilgamesh, Hercules, Beowulf, et al), super-powered or otherwise, who don't bother with actual secret identities in the comic book sense. Robin Hood comes very close, but I'd argue that he didn't maintain a dual identity so much as simply adopt a new name (and, obviously, lifestyle).
It's commonly accepted that the masked avenger trope popularized in comic books during the 1940s was directly inspired by '30s pulp fiction "mystery men" such as the Lone Ranger, the Shadow and the Phantom, with occasional glances further back to Baroness Orczy's Scarlet Pimpernel (circa 1904) - who is discounted here because, although an expert in disguise, he did not have a distinctive, masked alter ego. Johnston McCulley's Zorro, who premiered in The Curse of Capistrano (1919), certainly does qualify, and he is often justly cited as a direct precursor of the masked vigilante pulp heroes of the '30s.
However, Zorro himself had at least two predecessors, relatively little-known today, who had also manifested the "masked and costumed hero" mystique.
1915 saw the first appearance of British author Russell Thorndike's character, Dr. Christopher Syn, alias the Scarecrow. Doctor Syn: A Tale of the Romney Marsh was set in the coastal English village of Dymchurch during the 18th century, at a time when the villagers could only sustain themselves through smuggling. Dr. Syn - who was formerly and secretly a feared pirate known as Captain Clegg, and currently the apparently meek and mild village parson - assumes a third identity, that of the masked Scarecrow, to protect his parishioners from the King's Revenue Men.
The Scarecrow was an expert strategist, rider, fencer and marksman, whose intimidating mask, costume and shrieking laugh instilled fear into his enemies. His sidekick, Mr. Mipps, also assumed a secret identity (as the death-masked Hellspite) and they were headquartered in a hidden barn on the outskirts of Dymchurch.
Thorndike wrote a series of subsequent novels - actually prequels to Doctor Syn - which were later adapted into several movies, including three Disney tele-films (starring Patrick McGoohan as Dr. Syn/the Scarecrow):
Appearing decades even before the Scarecrow, however, the mysterious Spring Heeled Jack may very well be the actual originator of many "masked superhero" tropes.
Stories of Spring Heeled Jack had first emerged way back in the 1830s. Confused London newspaper reports melded with rumor and gossip to conjure something approaching mass hysteria concerning this very strange figure, who was said to possess supernatural agility. This early, folkloric rendition of Jack was an amorphous figure, sometimes said to be the devil in more-or-less human form; an inner-city boogeyman who seemed to delight in leaping out from the shadows and molesting young women.
Over a number of decades, though, actual (fearful) belief in Spring Heeled Jack gave way to nostalgia and whimsy. By the mid-19th century he was being featured in novels and plays, including a famous production mounted by the acrobat/actor George Conquest. By the 1880s Jack was beginning to be portrayed as an anti-hero - though often drawn and described as resembling a monstrous man/bat/lion hybrid, springing about the streets and rooftops of London. It then required only a short leap (!) of the imagination to transform him into an outright hero.
The several "penny dreadful" iterations of Spring Heeled Jack, many written by Alfred Burrage under the pseudonym "Charlton Lea", portrayed him as a nobleman who had been cheated out of his inheritance and who took up a devilish disguise to punish those responsible. Along the way, Spring Heeled Jack also rescued damsels in distress and generally stood up for the innocent and downtrodden. He wore a distinctive mask and costume and was capable of performing incredible leaps thanks to a special pair of boots, credited in one source to a secret mechanism invented by Indian street magicians.
Anticipating Zorro, Jack was fond of marking both enemies and territory by carving his initial with the point of his rapier. He also maintained a secret underground lair (in a converted crypt) and terrified his adversaries with his ringing laugh and catch-phrase, "The day is yours - leave the night to me!".
Thus, it may be that penny dreadful author Alfred Burrage originated a number of tropes that influenced subsequent generations of masked vigilante heroes. By the time comic book heroes such as Batman were created, those motifs had already been elaborated in pulp novels - most famously by Johnston McCulley's Zorro character and by Russell Thorndike's Scarecrow stories - and also in movie serials, to the point that they were part of the pop-literature zeitgeist.
If you can think of an earlier example of this trope, please let me know!