Wells is credited with establishing several extraterrestrial themes which were later greatly expanded by science fiction writers in the 20th century, including first contact and war between planets and their differing species. There were, however, stories of aliens and alien invasion prior to the publication of The War of the Worlds.
Voltaire's Micromégas (1752) includes two beings from Saturn and Sirius who, though human in appearance, are of immense size and visit the Earth out of curiosity. At first the difference in scale between them and the peoples of Earth makes them think that the planet is uninhabited. When they discover the haughty Earth-centric views of Earth philosophers, they are greatly amused by how important Earth beings think they are compared to greater beings in the universe such as themselves.
In 1892 Robert Potter, an Australian clergyman, published The Germ Growers in London. It describes a covert invasion by aliens who take on the appearance of human beings and attempt to develop a virulent disease to assist in their plans for global conquest. It was not widely read, and consequently Wells's vastly more successful novel is generally credited as the seminal alien invasion story.
The first science fiction to be set primarily on Mars may be Across the Zodiac: The Story of a Wrecked Record (1880) by Percy Greg. It concerned a civil war on Mars. Another Mars novel, this time dealing with benevolent Martians coming to Earth to give humankind the benefit of their advanced knowledge, was published in 1897 by Kurd Lasswitz – Two Planets (Auf Zwei Planeten). It was not translated until 1971, and thus may not have influenced Wells, although it did depict a Mars influenced by the ideas of Percival Lowell.
Other examples are Hugh MacColl's Mr. Stranger's Sealed Packet (1889), which took place on Mars, Gustavus W. Pope's Journey to Mars (1894), and Pharaoh's Broker by Elmer Dwiggins, writing under the name of Ellsworth Douglass, in which the protagonist encounters an Egyptian civilisation on Mars which, while parallel to that of Earth, has evolved somehow independently.
"The Crystal Egg", a short story by Wells that featured alien creatures on Mars, appeared in the May 1897 issue of the literary magazine The New Review. The narrative concerns a curious egg-shaped object in which a viewer could discern scenes on another world that had two moons in the sky, presumably indicating Mars. Strange winged beings could be seen pursuing activities in city-like structures, viewed from another crystal egg on a mast. The story appeared at the same time that The War of the Worlds was being serialized in Pearson's Magazine and has been interpreted as a kind of precursor to the full novel, suggesting that beings on Mars had been using such two-way crystals to observe Earth and its inhabitants. However, the Martians described in "The Crystal Egg" bear no resemblance to the octopus-like invaders of Earth in The War of the Worlds.