The Legion of Space by Jack Williamson; originally published as a six-part serial in the April, May, June, July, August, and September, 1934 issues of of Astounding Stories, which are available at the Internet Archive (, , , , , ). From the Wikipedia article, here's the plot background:
The story takes place in an era when humans have colonized the Solar System but dare not go farther, as the first extra-solar expedition to Barnard's Star failed and the survivors came back as babbling, grotesque, diseased madmen. These survivors spoke of a gigantic planet, populated by ferocious animals, and of the single city of the evil "Medusae". The Medusae are elephant-sized, four-eyed, flying 'jellyfish' with hundreds of tentacles. The Medusae cannot hear or speak, but communicate with one another via radio waves.
and the plot summary:
The Legion is the military and police force of the Solar System. It was created to keep the peace after the overthrow of the "Purples", a dynasty that ruled all humanity for generations. John Ulnar, a young graduate of the Legion academy, shares a surname with the Purples but is an enthusiastic supporter of the Legion.
A weapon called AKKA was used to defeat the Purples. Using a space/time distortion, it erases matter from the Universe—any matter, of any size, even a star or a planet. The secret of AKKA is kept in one family, descended from its creator, and is passed down from mother to daughter. One of the Legion's most important tasks is to guard the current Keeper, a beautiful young woman named Aladoree Anthar.
Through the machinations of his uncle, a powerful politician with a hidden agenda, John Ulnar is assigned to Aladoree's guard force at a secret fort on Mars. When she is kidnapped by a huge alien spaceship, John and the three other survivors of the guard force follow her kidnappers to a planet of Barnard's Star. They crash-land and must battle their way across a savage continent to the sole remaining citadel of the Medusae.
John Ulnar's uncle and his nephew have allied with the Medusae as a means to regain their empire, and have kidnapped Aladoree to ensure that AKKA is not used against them. The Medusae, however, turn on the Purples, seeking to destroy all humans and move to the Solar System, as their own world, far older than Earth, is spiraling into Barnard's Star.
John Ulnar and his companions rescue Aladoree, but the invasion of the Solar System has already begun. The Medusae conquer the Moon, set up bases there, and bombard Earth with gas projectiles. John, Aladoree, and their companions land on a ravaged Earth. Fighting off cannibals maddened by the gas, they build AKKA and destroy the Medusae fleets (and Earth's Moon as well).
The Legion of Space is the first book in the Legion of Space series (ISFDB, Wikipedia).