The U.S. Treasury on Friday said that the federal deficit for fiscal 2019 was $984 billion, a 26% increase from 2018 but still short of the $1 trillion mark previously forecast by the administration.

The gap between revenues and spending was the widest it's been in seven years as expenditures on defense, Medicare and interest payments on the national debt ballooned the shortfall.

The government said corporate tax revenues totaled $230 billion, up 12%, thanks to a rebound in the second half of the year. Individual tax revenues rose 2% to $1.7 trillion.

Receipts totaled $3.4 trillion, up 4% through September, while federal spending rose 8%, to $4.4 trillion.

The U.S. government also collected nearly $71 billion in customs duties, or tariffs, a 70% increase compared to the year-ago period. As a percentage of U.S. economic output the deficit was 4.6%, 0.8 percentage points higher than the previous year.

"President Trump's economic agenda is working: the Nation is experiencing the lowest unemployment rate in nearly 50 years, there are more jobs to fill than there are job seekers, and Americans are experiencing sustained year-over-year wage increases," said U.S. Treasury Secretary Steven Mnuchin in a press release.

"In order to truly put America on a sustainable financial path, we must enact proposals—like the President's 2020 budget plan—to cut wasteful and irresponsible spending," he added.

Annual deficits have nearly doubled under President Donald Trump's tenure notwithstanding an unemployment rate at multidecade lows and better earnings figures. Deficits usually shrink during times of economic growth as higher incomes and Wall Street profits buoy Treasury coffers, while automatic spending on items like food stamps decline.

Two big bipartisan spending bills, combined with the administration's landmark tax cuts, however, have defied the typical trends and instead aggravated deficits. The Congressional Budget Office projects the trillion-dollar deficit could come as soon as fiscal 2020.

Still, the Treasury's report will likely come as a relief to the Trump administration, which had previously forecast that the deficit would hit $1 trillion during the 2019 fiscal year. The White House pushed through a $1.5 trillion tax cut nearly two years ago that President Trump vowed would pay for itself.

— CNBC's Ylan Mui contributed to this report.