In a dramatic statement outside Conservative Central Office in London he said he would stand down as soon as a successor had been chosen.
" No man is indispensable. No man is more important than the party "
"No man is indispensable. No man is more important than the party," he said.
And the opening skirmishes of the battle to control the party began within hours as former deputy prime minister Michael Heseltine said Kenneth Clarke was the only person who could save the Tories.
Mr Clarke did not rule himself out of the leadership but said the party need time to reflect.
Party chairman Michael Ancram said the official race could not start until a chairman of the backbench 1922 Committee had been chosen by Tory MPs, who are due to assemble at parliament in the coming days.
He called Mr Hague's announcement "very brave", and said he had decided "some time ago" to quit as leader if the election result did not show a "significant improvement" in the party's position.
Mr Hague's decision to go came after UK voters delivered a second landslide victory for Tony Blair's Labour Party, which is expected to hold an overall majority of 167 in the new parliament.
Mr Blair hailed what he called Mr Hague's tremendous stoicism and resilience during the campaign and wished him well in the future.
In his statement Mr Hague said: "It is vital for leaders to listen and parties to change. I believe it is vital the party be given the chance to choose a leader who can build on my work, but also take new initiatives and hopefully command a larger personal following in the country.
"I've therefore decided to step down as leader of the Conservative party when a successor can be elected in the coming months."
The Tory leader decided to quit despite calls from senior members of the party - including shadow chancellor Michael Portillo - for a period of reflection.
But Mr Hague said he wanted to see a new leader elected in time for the party conference in October.
Speculation over possible successors to the Tory leadership is already rampant, with Mr Portillo favourite to take over.
Another leading contender - shadow home secretary Ann Widdecombe - has refused to rule out standing herself.
He said the party had presented an image of "a right-wing xenophobic party talking to itself in a very introspective way".
He criticised Mr Hague for fighting on the wrong issues and failing to take account of social changes such as the rise of multi-culturalism, gay rights and increased breakdown in marriage.
He called for the party to allow MPs to campaign as they wanted in any referendum on joining the euro.
And he warned against a faction within the party "who are determined to move on to a 'Europe out' basis".
Tory former European Commissioner Lord Brittan criticised Mr Hague's stance on Europe during the campaign, saying: "The Eurosceptic card was played for all it was worth and it was very easily trumped."
Speaking outside his constituency home in Derbyshire Kenneth Clarke said: "I will consider with care anything my colleagues say over the weekend.
"We do need to reflect first of all and consider where we position the party and where we go from here, so we can make better progress next time."
In his resignation speech, Mr Hague said voters had given Labour the benefit of the doubt without great enthusiasm.
And he warned the government that "a second successive failure to deliver would breed great disillusionment and cynicism, not only about the government but politics in general."