Although he had not been named as a suspect, he stated he thought the investigation conflicted with his continued office.
On Tuesday, prosecutors announced that they were looking into concessions granted for the production of hydrogen and lithium mines.
Five persons have been taken into custody, the newspaper Público reports.
Among them are two individuals who are considered close to Mr. Costa: Vítor Escária, his chief of staff, and a business consultant, according to Público.
In the meantime, Joao Galamba, the minister of infrastructure, has been charged as part of the investigation into energy deals.
The prime minister stated on Tuesday that "the dignity of the tasks of prime minister is not consistent with any question about his honesty, his good behavior and even less with the suspicion of the practice of any criminal act."
He acknowledged that the corruption inquiry had taken him off guard but that he would work with it nonetheless.
He went on, "No illegal behavior or even any act that is vulnerable to reproach weighs on my conscience."
President Marcelo Rebelo de Sousa announced his resignation shortly after Mr. Costa delivered a speech on television.
His home was searched by some 140 detectives, along with 17 other residential residences, 25 other locations, including the prime minister's chief of staff office and two government departments.
In Sines, the deep-water port that is the focus of investment in hydrogen for use as an energy source, they also searched municipal offices.
Amidst the political crisis, Portugal's primary PSI 20 share index had an almost 3% decrease.