Steady economic growth, higher taxes, lower government spending and increased dividends from mortgage giants Fannie Mae and Freddie Mac have helped shrink the deficit.
Still, looming budget fights in Congress are complicating the picture. When lawmakers return from their recess in September, they will need to increase the government's borrowing limit. They will also have to approve a spending plan for the budget year that begins Oct. 1. Republicans and Democrats remain far apart on both measures.
Republicans want President Barack Obama to accept deeper cuts in domestic government programs and in expensive benefit programs such as Medicare and Social Security. Obama has argued that Republicans must be willing to accept higher taxes on the highest-earning Americans.
Conservative House Republicans have signaled a willingness to force a partial government shutdown as a way of defunding Obama's universal health care law, which they oppose.
A possible compromise would be to approve a stopgap budget to keep the government operating after Oct. 1 while both sides seek a permanent solution.
Obama has vowed not to negotiate with Congress over raising the borrowing limit as he did in 2011. But some Republicans want to test the president's resolve even if it rattles financial markets. Investors fear a doomsday scenario in which the country would default on its debt, which it has never done.
Through July, the government collected $2.29 trillion in revenue, up 13.9 percent from the same 10 months last year. Government spending during this period totaled $2.89 trillion, down 2.9 percent from a year ago. That decline reflects, in part, automatic government spending cuts that began taking effect March 1.
Collectively, the government's deficits increase the national debt, now at $16.7 trillion.