"The Last Evolution", a short story by John W. Campbell, Jr., available at Project Gutenberg and LibriVox. Maybe one of these covers will ring a bell?
From Everett F. Bleiler's review in Science-Fiction: The Gernsback Years (emphasis added):
Mankind has hit its peak. Restricted in number to about ten million people, it has achieved remarkable scientific heights, including the development of sentient, thinking machines. The resultant culture is almost a symbiosis or benevolent partnership between machine and man.
The story is narrated by F-2, the last of the predecessors of an ultimate machine. An invasion, one hundred great spaceships manned by somewhat humanoid, chitin-armored beings, came from an unnamed source. The humans, who long had abandoned war, had few weapons, although their investigating machines—the size of a hand—were effective in spying on invader activities.
In a great space battle, Terrestrial rays were inadequate against the defenses of the invaders (who had a superior type of atomic energy), and the invaders continued on to Earth, which they systematically bathed in a green death ray. Torpedoes finally destroyed the invading fleet, but the outlook remained bad. While the machines were not damaged by the bath of radiation, humanity was doomed, for there was no defense against the green ray.
A second invasion took place as an armada of one thousand invader ships entered the solar system. Hoping to preserve mankind, the great machines created even more advanced machines, including the narrator F-2, but even this was inadequate. Then F-2 created the ultimate, a machine or being composed of pure force. This machine, if it can so be called, became the heir to mankind, which is now extinct. While F-2 finally developed a shield against the green ray, it was too late.
The supermachine approached the alien fleet, which was about to destroy Mars, turned the flagship inside out dimensionally, flashed a stasis ray on it which would prevent change of any sort, and ordered the aliens out of the solar system. They obeyed, for the sphere of force was irresistible.
Evolution is now complete, from animal, to man, to machine.