Sweden's centre-right opposition bloc has defeated the ruling Social Democrat party in the country's closest-fought general election for decades.
Mr Reinfeldt has promised to reform the welfare state
Moderate party leader Fredrik Reinfeldt declared victory as near-complete results gave him a 1% lead.
Minutes later, Prime Minister Goran Persson accepted defeat and said he and the government would resign, ending 12 years of Social Democrat rule.
The centre-left party has led Sweden for all but 10 of the past 89 years.
Mr Reinfeldt, who had promised to cut taxes and reform Sweden's cradle-to-grave welfare state, took to the stage in front of supporters with his arms raised.
"We ran in the election as the New Moderates, we have won the election as the New Moderates and we will also together with our Alliance friends govern Sweden as the New Moderates," he said.
Mr Persson told his supporters he would step down as party leader in March 2007.
Mr Persson said he would step down as party leader
"We have lost the election but we are not a beaten party," he said. "We will never accept the right's change of system - we will hit back!"
Key issues in the election included whether Sweden's generous welfare model must reform for it to survive in the global economy.
Opinion polls had put the centre-right alliance consistently neck-and-neck with the Social Democrats.
The latest poll, published before voting began, put the challengers a few points ahead.
Both leaders had admitted the result was expected to be extremely tight.
"If you want to use swimming terminology, we are going to be the ones who touch the finish a few hundredths of a second before the opposition," Mr Persson said on Saturday.
His rival urged supporters to turn out and vote.
"Don't believe the opinion polls. Persuade neighbours and friends to go vote," said Mr Reinfeldt.
The opposition says changes to Sweden's rigid labour market and high cost welfare system are long overdue, and promises to cut both employer taxes and unemployment benefits.
It also wants to cut the large social sector, which currently employs 30% of the Swedish job force.
Mr Reinfeldt has accused the government of disregarding the high unemployment rate, and for not making sure the country can continue to compete in a global market.
The government maintains the unemployment rate is a low 6%, while the opposition says it is around 10%, taking into account the many people on sick leave and in job training schemes.
Mr Persson has accused the opposition of wanting to destroy job security and make dangerous cuts to the welfare state.
He said this would undermine Sweden's unique social model - a cradle to grave welfare system and strong economic growth.