These two relatively volatile components of the data subtracted a combined 2.6 percentage points from the overall growth figure.
Consumer spending did pick up, as did business investment, suggesting that the economy may have some underlying momentum. Sales of computers and cars both made positive contributions to the economy's performance.
Residential investment also grew 15%, adding to evidence that the housing market has finally turned the corner.
"Frankly, this is the best-looking contraction in US [gross domestic product] you'll ever see," said Paul Ashworth, an economist at Capital Economics, in a note to clients. "The drag from defence spending and inventories is a one-off. The rest of the report is all encouraging."
The October-to-December period was also negatively affected by Storm Sandy, which caused the closure of many factories and businesses in the New York area, and by a sharp drop in exports.
Growth for 2012 as a whole came in at 2.2%, up from 1.8% in 2011, but still unusually slow compared with previous economic recoveries in the US following recessions in the post-War era.
Looking ahead, domestic spending in the current quarter is expected to be dogged by further uncertainty over the federal government's tax and spending.
Workers have already experienced a 2% average cut in their take-home pay, due to the expiry of the payroll tax holiday. That means a household earning $50,000 a year will have about $1,000 less to spend.
The income lost is likely to have been behind a sharp fall in consumer confidence recorded by surveys in January.
Meanwhile, the recently re-elected President Barack Obama and Congress are expected to clash once again in the coming months over the debt ceiling.
The US Treasury is approaching the $16.4tn (£10.3tn) legal limit on its total debt, and must gain permission from Congress to borrow the money needed for it to continue meeting its bills.
Last time there was a stand-off over the issue, in the summer of 2011, the political deadlock prompted ratings agency Standard & Poor's to deprive the US of its top AAA rating, a move that sent stock markets sharply lower.
The US House of Representatives has passed a bill to extend the country's debt limit until May, deferring the budget debate for a few months at least.