SACRAMENTO -- Call it the Amazing Vanishing Deficit.

Capitol observers were shocked Thursday when California Gov. Jerry Brown revealed that his administration had produced only the second balanced budget in the last decade. But it turns out producing the deficit-free budget was a tricky feat for Brown and his finance team.

The nonpartisan Legislative Analyst's Office had projected a $1.9 billion deficit. So how did the governor's team erase the red ink?

Brown's finance officials offered a deeper explanation on Friday:

The governor's budget delayed paying back $1 billion in loan payments to previously raided funds and came up with a rosier economic forecast than the LAO's.

In the past, the state had borrowed about $30 billion from special funds, schools and local governments. Last year, Brown had planned to pay back $5.2 billion to those funds. Instead, he's paying $4.2 billion.

"We assess what the repayment schedule is to special funds based on their needs and determined we didn't need to repay them this year," said H.D. Palmer, spokesman for the Department of Finance.

An improved economy with more robust revenues -- $300 million more than the legislative analyst projected for this year and next -- also made the budget balancing easier, Palmer said.

But the finance department insists its figures are more realistic and is using information not available to the analyst's office when it did its forecast late last year. Sales and personal income taxes -- largely based on capital gains from an improving stock market -- looked much stronger than either had been assuming, Palmer said.

It also helped that Brown could count the roughly $900 million in new revenue from Proposition 39 -- the measure approved by voters in November that closes corporate loopholes and finances energy-efficiency programs in schools and community colleges -- as part of the general fund's balance.

"When it goes to schools and community colleges, it reduces the general fund costs because it's available as a source to meet the Proposition 98 guarantee," said state Finance Director Ana Matosantos, referring to the constitutional amendment requiring that about 40 percent of all general funds goes to schools.

Brown also assumes more revenue from the dissolution of local redevelopment agencies than the legislative analyst's forecast.

"Counties are receiving significant increases in property tax revenues -- cities and special districts as well," Matosantos said. "A portion of that is going to school districts. When dollars flow to school districts, then our general fund obligation to meet the Proposition 98 guarantee declines."

Still, land mines litter the fiscal road ahead.

The budget's rosy picture could sour if national economic conditions deteriorate as a result of a partisan breakdown over the national debt ceiling, economists say. And potential court decisions blocking Brown's plans to scale back prison spending and get out from under a federal court's mandates on inmate population and medical care could complicate the budget picture before it must be finalized in June.

In addition, possible increases in the state's health care costs with the implementation of Obamacare could also mean that legislators would have to climb out of a deficit after all.

Brown's budget assumed the economy wouldn't incur "sharp" across-the-board federal tax increases or spending cuts in 2013 -- and that income tax rates would rise only for higher income households. Its forecast assumes that Congress will resolve differences over the debt limit and avoid the recession that would likely hit if it doesn't.

States are clearly worried.

The National Governors Association this week urged Congress to do everything it can to resolve the issue.

Delaware Gov. Jack Markell said if the debt limit isn't increased soon, there will be disruptions in federal spending and capital markets that could hurt states.

"Our economies are tightly linked to the national economy and as a result our states' prosperity depends -- the prosperity of our citizens depend in no small measure -- on the ability of public servants in Washington to come to terms on a path forward," said Markell, who is chairman of the association.

One prediction that Brown's finance officials missed was that the 2 percent federal payroll tax holiday would continue at least for another year. President Obama and Congress allowed it to expire, a potential loss of about $1 billion in economic activity because of smaller paychecks in the next year, said economist Jeffrey Michael of the University of the Pacific's Business Forecasting Center.

"That's certainly one of the bigger hits, a short-run hit to the economic outlook," Michael said. "Their economic forecast is reasonable but a little bit optimistic because it assumed the payroll tax cut would continue. That will have some impact on economic performance and consumer spending."

Contact Steven Harmon at 916-441-2101. Follow him at Twitter.com/ssharmon. Read the Political Blotter at IBAbuzz.com/politics.