Retiring is becoming more and more expensive, and it's possible you'll need well over $1 million to enjoy your senior years comfortably. If you plan to spend your retirement traveling the world or enjoying other expensive hobbies, you could need even more money in savings.

This goal can be difficult to achieve, though -- especially if you're not already wealthy. Fortunately, it is possible to retire a multimillionaire by investing in the stock market. By taking these five steps, you'll be well on your way to retiring rich.

Mature man and woman sitting on a boat smiling

Image source: Getty Images.

1. Don't save -- invest

It's not enough to simply save for retirement; you'll need to invest. If you're stashing your money in a savings account, it won't grow nearly as much as it could if you were investing it in the stock market.

Even high-yield savings accounts only have interest rates of around 1% per year. By comparison, the S&P 500 has earned an average rate of return of around 10% per year since its inception.

To retire a multimillionaire, you'll need your money to grow as much as possible (without taking unnecessary risks, of course). While this doesn't mean investing all your cash in the latest up-and-coming start-up, it does mean you're better off investing than keeping your money in a savings account.

2. Start investing early

Time is your most valuable asset when it comes to preparing for retirement. By starting to invest earlier in life, it will be easier to build a robust retirement fund.

Say, for example, you'd like to retire at age 67 with $2 million. Let's also say you're earning a modest 8% annual rate of return on your investments. If you had started saving at age 25, you'd need to invest around $550 per month to reach your goal. But if you had waited until age 35, you'd have to invest roughly $1,250 per month, all other factors remaining the same.

If you're off to a late start, that doesn't necessarily mean you can't retire a multimillionaire. But it's much better to start investing now rather than waiting.

3. Invest consistently

The more consistently you're able to save, the more your money will grow over time. Investing a set amount every month can also make it easier to stick to your goals.

Rather than simply investing whatever money you have left over at the end of the month, try to build retirement savings into your budget. By setting aside a certain amount each and every month, you're more likely to reach your long-term goals.

4. Take advantage of employer matching contributions

Employer matching contributions are essentially free money. All you have to do is contribute to your 401(k), and your employer will match a portion of those contributions up to a percentage of your salary.

These contributions can add up substantially over time, too. Say, for example, you're earning $60,000 per year and your employer will match your 401(k) contributions up to 3% of your salary -- or $1,800 per year.

Let's also say that you're earning an 8% average rate of return on your investments. By earning the full employer match consistently, that $1,800 per year can turn into more than $466,000 after 40 years. That's only the money from your employer, too. Once you factor in your own contributions, you'll have at least twice that much in total.

5. Avoid making withdrawals

Once you invest your money, try your best to leave it alone for as long as possible. Withdrawing your investments before retirement age can have serious consequences and make it harder to reach your goal.

If you withdraw money from your 401(k) or traditional IRA before age 59 1/2, you could be subject to a 10% penalty and income taxes on the amount you withdraw. In addition, every time you take money from your retirement account, you're making it more difficult for your money to grow. This can affect your long-term savings and reduce your chances of becoming a multimillionaire.

Retiring a multimillionaire is challenging, but it can be done. By making these five moves, you'll give yourself the best shot at retiring wealthy.