With an HSA you can make tax-deductible contributions each year to pay for current and future health care costs. What you don't use in any given year will stay invested and continue to grow tax-free, assuming you eventually pull it out to use for medical costs. If you use any withdrawal for non-medical costs it will be taxed when you use it - and if you are not yet 65, you'll owe a 10% penalty too. So draw on the account to pay medical costs only.
The annual contribution limit to an HSA in 2018 is $3,450 for an individual and $6,900 for a family. If you are at least 55 years old you can contribute an additional $1,000 in 2018. Many employers offer an HSA plan.
If your employer offers an HSA, it typically works just like a traditional 401(k): Your contribution is taken out of your paycheck on a pre-tax basis. Your employer may also kick in a contribution. If you have a health savings account on your own, you still get the tax break; you just claim the contribution as an "above the line" deduction on your tax return, and your taxable income will be reduced by the amount of your contribution.