Health Savings Accounts are surging in popularity, and that can lead to some complications for older workers who enroll in Medicare.

Health Savings Accounts (HSAs) are offered to workers enrolled in high-deductible health insurance plans. The accounts are used primarily to meet deductible costs; employers often contribute and workers can make pretax contributions up to $3,350 for individuals, and $6,750 for families; the dollars can be invested and later spent tax-free to meet healthcare expenses.

Twenty-four percent of U.S. workers were enrolled in high-deductible health plans last year, according to the Kaiser Family Foundation. And 15 percent of them were in plans coupled with an HSA. That compares with 6 percent using HSA-linked plans as recently as 2010. Assets in HSA accounts rose 25 percent last year, and the number of accounts rose 22 percent, according to a report by Devenir, an HSA investment adviser and consulting firm.

But as more employees work past traditional retirement age, some sticky issues arise for HSA account holders tied to enrollment in Medicare. The key issue: HSAs can only be used alongside qualified high-deductible health insurance plans.

The minimum deductible allowed for HSA-qualified accounts this year is $1,300 for individual coverage ($2,600 for family coverage). Medicare is not considered a high-deductible plan, although the Part A deductible this year is $1,288 (for Part B, it is $166).

That means that if a worker––or a spouse covered on the employer’s plan––signs up for Medicare coverage, the worker must stop contributing to the HSA, although withdrawals can continue.

The normal enrollment age for Medicare is 65, but people who are still working at that point often stay on the health plans of their employers (more on that below). In certain situations, the worker or a retired spouse might enroll for some Medicare benefits. Moreover, if the worker or spouse claims Social Security, that can trigger an automatic enrollment in Medicare Part A and B.

That would require the worker to stop contributing to the HSA, and the contributions actually would need to stop six months before that Social Security claim occurs.

That is because Medicare Part A is retroactive for up to six months, assuming the enrollee was eligible for coverage during those months. Failing to do that can lead to a tax penalty.

"The Medicare problem is a basic flaw in the way HSAs are designed," said Jody Dietel, chief compliance officer of WageWorks Inc a provider of HSA and other consumer-directed benefit plans to employers.