Chancellor Gordon Brown says he will meet his self-imposed "golden rule" on borrowing and spending and balance the books over a six-year cycle.
Higher-than-expected tax revenue on soaring profits at UK oil giants is to make up the shortfall many predicted.
In his annual pre-Budget report Mr Brown also said the UK economy was on track to grow this year by 3.25%.
And he surprised analysts by insisting that growth would be as strong in 2005; most experts predict growth of 2.6%.
For the current financial year Mr Brown expects that he will have to borrow £34.2bn, just £1.3bn more than forecast, while next year he will be short of about £2bn.
GOLDEN RULE EXPLAINED
The 'rule', introduced by Chancellor Brown, governs how much the government can borrow, and for what purpose
It means the government should borrow only to fund investment, and not day-to-day - or 'current' - spending
The policy's success is measured by whether surpluses and deficits can be balanced over a full economic cycle
The current economic cycle is expected to end in 2006
This is well below the predictions of most analysts, who expect a "black hole" of about £10bn.
The chancellor counts on a slowdown in government spending and higher tax revenue. As oil prices soar, oil companies are making larger profits, which in turn will result in an extra £1.5bn in taxes this year and £2bn next, he calculates.
Robert Bootle, economic adviser to accounting firm Deloitte, doubts this will be enough.
"Tax receipts from oil companies [are] unlikely to make up the shortfall," he said, warning that "the chancellor is in serious danger of breaking his own golden rule".
Under the "golden rule" of borrowing and spending, invented by Mr Brown, a chancellor should borrow only to invest - in items such as schools and hospitals - and should not go into debt to pay for day-to-day spending such as salaries and running government services.
Shadow chancellor Oliver Letwin questioned Mr Brown's figures as well, warning that a vast majority of economists and think tanks doubted the chancellor's borrowing figures.
"The tide is going out on the chancellor's credibility," he said, adding that the "golden rule" had "turned to dross in his hands".
But Mr Brown dismissed his critics, predicting that he would be able to balance his books not just over the current economic cycle, which is expected to run for another 18 months, but also all the way to the financial year 2009/10.
The "golden rule" is supposed to keep state spending under control, while giving the UK government more flexibility than for example the eurozone's "stability pact", which has strict annual caps for government borrowing.
The rule also allows the government to balance borrowing and surpluses over the country's economic cycle - as growth first accelerates and then slows.
In his Commons speech, Mr Brown said the government had delivered a record period of steady economic growth, low inflation, low debt and high employment.
"In any other decade, a 100% increase in oil prices, a 50% rise in industrial materials prices and a 70% rise in metal prices would have led to inflation and instability," he said.
"But with continued and necessary discipline among wage bargainers in the private and public sector and the resilience of our new monetary and fiscal framework, inflation is expected to be just 1.75% next year and 2% in the years to follow."
And he surprised economists with his bullish short-term forecast for the UK economy.
Mr Brown said the UK economy would grow next year by between 3% and 3.5% - the same rate as predicted for this year.
This contrasts with the consensus forecast of 2.6% growth for 2005.
"The growth and public borrowing forecasts contained in the pre-Budget report look very optimistic," said Howard Archer, economist at Global Insight.
So far the chancellor's record on correctly predicting growth has been enviable, while many economists have underestimated the strength of the economy.
But his record on projected tax revenues is more patchy.
After accumulating big budget surpluses at the start of the economic upswing, the chancellor's projections until recently assumed a "golden rule" surplus of £11bn.
Now he expects a surplus of £8bn over the next 18 months - a number that BBC economics editor Evan Davis describes as being "within the margin of error".
Tax revenues have been below expectations over the past couple of years, and this financial year neither tax revenues nor government spending have been going to plan.
Spending has grown much faster than forecast - by about 6.6% instead of the predicted 5.2%.
And while in March this year he predicted revenue growth of 7.8%, so far tax income has gone up by just 6.3%.
Mr Brown, however, believes that he will be able to keep next year's borrowing to the predicted £33bn.
"This is a hope-for-the-best pre-Budget... not a cautious set of assumptions," said BBC economics editor Evans Davis.