Prosecutors earlier arrested Costa’s chief of staff and named Infrastructure Minister Joao Galamba as a formal suspect in a corruption probe.
Costa, who prosecutors said was the target of a separate investigation, announced the decision in a televised statement after meeting President Marcelo Rebelo de Sousa on Tuesday.
The 62-year-old Costa, Portugal’s Socialist leader since 2015, defended his innocence.
“I totally trust the justice system,” he said. “If there are suspicions, then the judicial authorities are free to look into them … I am not above the law.”
President de Sousa is expected to accept his resignation.
The opposition has demanded that the government step down with immediate effect.
Hours before the announcement, Portuguese police arrested Vitor Escaria, Costa’s chief of staff, during raids on several public buildings and additional properties as part of the corruption probe.
Prosecutors named Infrastructure Minister Joao Galamba as a formal suspect and detained Costa’s chief of staff. The head of the country’s environmental agency was also named as a suspect.
The state prosecutor’s office has said that the country’s Supreme Court is looking at the “use of the prime minister’s name and his involvement to unlock” the activities being investigated.
Activities being explored by the investigating judge include allegations of malfeasance, corruption of elected officials, and influence peddling relating to lithium mine concessions near Portugal’s northern border with Spain, as well as plans for a green hydrogen plant and data centre in the town of Sines, about 100km (62 miles) south of Lisbon.
The hydrogen plant and lithium mines are part of a green initiative backed by the European Union. In addition to Costa’s chief of staff, arrest warrants were also issued for the mayor of the town of Sines and two executives at the company Start Campus, tasked with building the hydrogen production project and data centre.