He said he will also quit today as chairman of his conservative Civic Democratic Party.
He has been under pressure to go since police conducted raids all across the country this week and arrested eight people, including his closest aide and the head of his office, Jana Nagyova.
She was charged with ordering a military intelligence agency to spy on three people, including Mr Necas’ estranged wife.
Seven other people, including the current and former heads of the Military Intelligence agency and three former politicians of his party, were charged with bribery or misuse of power.
“I am aware of my political responsibility,” Mr Necas said.
His decision will end his three-party coalition government, which was created after the 2010 parliamentary election. But Mr Necas said he hopes it can stay in power until a parliamentary election planned next year.
This is an optimal solution of the current situation,” he said. Two coalition partners, the conservative TOP 09 party and the Liberal Democrats, agreed with that plan yesterday.
“We’re obliged to do all we can for the government to continue,” said Finance Minister Miroslav Kalousek, the deputy head of TOP 09.
That might not happen, however. It is up to the President Milos Zeman to select a new prime minister who would try to form a new government, and it is not immediately clear if he is ready to accept such a solution. The current coalition also does not have a clear parliamentary majority and governs with the help of independent politicians.
And early elections are not easy to call because it would have to be approved by three-fifths of the 200 politicians, and the opposition does not have enough seats to force it.
The negotiations between the parties are expected to start immediately, and it is not clear how much time they will need to find a solution to the crisis.
Earlier this week, prosecutors said Ms Nagyova was suspected of directing the alleged illegal surveillance without any authorisation. In their explanation for the sweeping raids at government offices and other locations, they said her motives were “purely private”.
Mr Necas announced earlier this week that he and his wife, Radka, have filed for divorce. Newspapers have speculated about an affair between him and Ms Nagyova.