Getting a raise is a good thing, right?

It is unless you increase your spending each time you get a bump in pay. The result may be that you will fall short of what you need for retirement.

Raises, oddly, "can actually make it harder to achieve a comfortable retirement," according to a new analysis from the investment research firm Morningstar.

The prime culprit is lifestyle "creep."

A fatter paycheck makes people feel richer, so they feel empowered to buy that fancy car or bigger house, said Steve Wendel, head of behavioral science at Morningstar.

But as their expenses grow, they risk falling behind on retirement savings if they stick to saving the same proportion of their income.

If your salary goes to $120,000 from $100,000 and you keep saving 10% of your income, you will be saving more in absolute terms — an extra $2,000.

But you really need to save even more if you want to keep that fancier lifestyle in retirement — and many people don't do that, the research found.

Morningstar analyzed data from a big retirement plan manager to compare the average change in savings rates for people who got a raise and those who didn't.

It turns out that there was little difference between the two groups. People tend to save about the same, in percentage terms, regardless of whether they got a boost in pay.

"When people get a raise, they're not putting it aside," Wendel said.

Other sources of retirement income, like Social Security, are relatively fixed, the report noted. (Social Security payments do increase with wages, but only up to certain limits.)

So people living more lavishly need to save more. Older people, in particular, need to save more — even if they have been diligent savers — because they have less time to catch up before retirement.

Just how much more should people save?

Morningstar suggested a simple rule of thumb:

Each time you get a raise, spend a percentage of it that's twice the number of years to retirement — and save the rest. That means if you expect to retire in 10 years, you can spend 20% of the raise, guilt free.

Younger people can safely spend more of the raise because they have more time for their investments to grow.

Those with 30 years to retirement could spend about 60% of their raise, under the rule.

Rules of thumb can help simplify complex calculations for savers, Wendel said, but for a detailed analysis of your retirement finances, it may help to seek professional advice.