I am searching for a book or short story about an alien invasion of earth and the reappearance of Elves in the world.
In Poul Anderson's 1951 elves-and-aliens yarn "Interloper" (novelette, first published in The Magazine of Fantasy and Science Fiction, April 1951, available at the Internet Archive) the Earth is secretly ruled and exploited by aliens from several nearby stars
"Precisely what forms of exploitation are carried on here?" asked the Alf.
"Various ones, depending on the race," said Hraagung. "The Procyonites find Earthlings an excellent source of blood. The Altairians simply want to observe historical processes, as part of their project of mass-action study. The Arcturian economy depends on controlling the productive facilities of a great number of subject planets, skimming the cream off their industry and agriculture. We of Sirius find Earth a convenient military outpost and refueling station—also—" the thought was like a tiger licking its lips—"the natives serve other purposes."
who quietly invaded earth in ancient times.
"You must realize," thought Kane, almost conversationally, "that the exploitation of Earth is quite old. In fact, the first Vaettir arrived here—" he thought of a length of time which Beoric rendered as about four thousand years ago. "We began to colonize extensively about seven centuries ago, at which time the native civilization was less complex and it was very easy to pass oneself off as whatever one desired. Thus our organization is firmly established. Through the corporations we control on Earth, the governments which we influence—or run outright whenever it is necessary, through the old and highly reputable family connections of some of the Vaettir, through a number of other means which you can easily imagine, we can do exactly as we please, under the very noses of the natives." For a moment his iron features split in a grin. "The only ones who suspect that Earthlings are not their own property are labelled cranks—and generally the label is quite correct."
The story tells how the elves do battle with the aliens.
An arrow whined, and through blurring eyes Beoric saw the Denebian pitch forward with the feathered shaft through his breast. He saw his fellows, the warriors of the Alfar, coming through the door, and they had cast off their human coats and hats, they wore the golden-shining beryllium-copper helmets and byrnies of the old days, and they carried the old weapons. Longbow, spear, sword, ax, and a shrieking fury that clamored between the metal walls, the blood-howl for vengeance.
After defeating the aliens, the elves plan to use their spaceship to leave Earth and find a new home among the stars.
"It's strange," mused Beoric. "The aliens knew that they had caused most of the demon-myths of Earth. It did not occur to them that the myths of Faërie might also have an origin in reality. That I might be—an elf! That peris and nixies and kobolds and brownies and fairies and the sea people and all the rest might, in a way, really exist . . . And so man's old enemy, the shifty unreliable folk of the night, becomes in the end his saviour. And Alfheim changes from myth to—a real planet."
"Aye. And—well done, Beoric," said King Oberon.
This may be the Commonwealth Saga by Peter F Hamilton, comprising two books: Pandora's Star and Judas Unchained.
The alien invasion is by a group known as the Primes, following discovery (and unlocking) of their home world, and the "Elves" are a separate alien species known as the Silfen.