The budget deals of the past two years and a recovering economy are rapidly mopping up the tide of red ink that swept over Washington after the 2007 recession.

After four years of budget deficits in excess of $1 trillion, the nonpartisan Congressional Budget Office forecast Tuesday that this year’s deficit will plummet to $642 billion, or 4 percent of the nation’s total economic output.

That’s $200 billion lower than the CBO forecast in February. Analysts attributed the sunnier outlook to higher-than-expected tax revenue and about $95 billion in higher payments from mortgage giants Fannie Mae and Freddie Mac, which are profiting from a recovering housing market.

The forecast puts the nation on track for its smallest deficit since 2008, before the recession hit in full force. And the CBO predicts that the gap between revenue and spending will continue to shrink through 2015, when it will fall to just over 2 percent of the economy — well within the bounds of what economists consider to be economically sustainable.

After 2015, the CBO forecasts that deficits will gradually begin rising again as the baby-boom generation taps into Social Security and Medicare. Although borrowing will stabilize, the national debt will remain at historically high levels, the CBO said, stuck above 70 percent of the economy throughout the next decade.

The battle over the 2014 budget

That’s higher than at any time in U.S. history other than World War II. In the past 40 years, the national debt has averaged about 39 percent of gross domestic product.

Still, the improvement in the short-term forecast has removed the air of crisis that has hovered around the budget deficit since President Obama took office. On Tuesday, some analysts urged congressional Republicans to call an end to their fixation on budget cutting.

“Certainly, if facts drove the day, this update would be a fire hose for the hair-on-fire austerity crowd [regarding] the near-term deficit,” wrote Jared Bernstein, former chief economist to Vice President Biden, now at the left-leaning Center on Budget and Policy Priorities. “The patient is checking out of the hospital while [Republican leaders] are still preparing for major surgery.”

Other analysts — and some lawmakers — worry that the shrinking deficit will make it harder to finish the job of debt-reduction that Obama and Congress began in earnest after the GOP took control of the House in 2011.

Policymakers have capped spending on agency budgets, permitted across-the-board spend­ing cuts known as the sequester to take effect, let a temporary cut in the payroll tax expire and raised taxes on the nation’s wealthiest households. They have done nothing, however, to tackle the long-term affordability of Social Security and Medicare, which are projected to be the biggest drivers of future borrowing as the population ages.

“What we should do is enjoy the victory lap. We’ve made some progress. But don’t let it get in the way of solving the larger problem,” said Maya MacGuineas, president of the bipartisan Committee for a Responsible Federal Budget. “We did the easy stuff, but we’re still left staring at the hard choices.”

Obama has pressed Republicans to replace the sequester, worth about $1.1 trillion over the next decade, with about $1.8 trillion in alternative policies, including $600 billion in new taxes and $400 billion in savings from Medicare. Obama has also offered to use a less-generous measure of inflation to calculate cost-of-living increases for Social Security benefits.

But pressure for a deal has dissipated along with the deficit. Many Republicans are now determined to keep the sequester in place, even though it would require them to cut agency budgets even more deeply for the 2014 fiscal year, which begins in October.

“I don’t anticipate that the sequester gets turned off,” said Sen. John Thune (R-S.D.), the No. 3 Republican in the Senate. “That to me is one of the few areas where we actually have cut spending.”

Meanwhile, the CBO predicted Tuesday that the Treasury will be able to pay the nation’s bills until as late as November without seeking additional borrowing authority from Congress.

That gives policymakers months to plan their next move. Fractious House Republicans are scheduled to begin that process with a lengthy meeting Wednesday.