About 8.8 million people signed up for insurance on the federal health care exchange during Obamacare's latest open enrollment period, a senior health official announced on Thursday.

The number — which topped expectations — was down only modestly from last year's 9.2 million sign-ups despite an enrollment period that was half as long, a 90 percent cut by the Trump administration in advertising for the program, and a tumultuous year in which Congress repeatedly tried to replace the law and the president cut off cost-sharing reduction payments (CSRs) to insurers.

The latest figures included only sign-ups through HealthCare.gov, the federal site used by 39 states, and not enrollments through state exchanges, some of which are still open. In the final week, 4.1 million people were signed up, including existing customers who were automatically enrolled in a plan. The numbers may go up slightly because some customers were delayed in enrolling by the deadline due to high volume and because some areas affected by hurricanes were granted an extended enrollment period.

Seema Verma, head of the Centers for Medicare and Medicaid Services, announced the total enrollment figures on Twitter and portrayed them as a victory that vindicated the Trump administration's "more cost effective" approach to promoting the law.

Exchange open enrollment for 2018 coverage ended w/ approx 8.8M people enrolling in coverage. Great job to the @CMSGov team for the work you did to make this the smoothest experience for consumers to date. We take pride in providing great customer service. — CMS Administrator (@SeemaCMS) December 21, 2017

This year CMS took a more cost effective outreach approach, spending just over $1 per enrollee on outreach and education for Exchange coverage compared to nearly $11 per enrollee last year. — CMS Administrator (@SeemaCMS) December 21, 2017

But the higher-than-expected sign-ups ran counter to President Donald Trump's pronouncements this year that the law was "dead," "finished" and "gone," as well as his explicitly stated plan to "let Obamacare fail" in order to force Democrats to back its repeal.

His statements about the law were so strong that insurers and health experts worried some customers would be confused during the enrollment period as to whether it still existed. As recently as Wednesday, Trump called the law "essentially repealed" after the House and Senate passed a tax bill that will repeal its penalty for Americans who forgo health coverage.

It's possible a major move by Trump that he predicted would cripple the law — his decision to end CSR payments, citing a legal dispute — actually boosted enrollment. While the shift raised premiums on paper, insurers and state officials reorganized plans in ways that often boosted subsidies for customers through the law. For millions of Americans, the result was cheaper coverage — in many places, high-deductible plans were available at a monthly premium of $0 while prices were down for low-deductible plans.

"Demand for affordable coverage this year was higher than it's ever been before, proving yet again the staying power of the ACA marketplaces," Lori Lodes, a former Obama health official who co-founded the grass-roots enrollment campaign Get America Covered, told NBC News. "Enrollment defied expectations and all of the efforts by the Trump administration to undermine people signing up."