Corrections and Clarifications: An earlier version misstated the number of 401(k) millionaires from a year earlier.

A record number of investors became 401(k) millionaires this spring.

At the end of the second quarter, 168,000 people with 401(k)s managed by Fidelity Investments had at least $1 million in their accounts, a rise of 50,000 people from a year earlier when there were 118,000, according to a new study by Fidelity, one of the nation's largest administrators of workplace retirement accounts. While gaining, that exclusive group of savers is still just a fraction of the 16.1 million people who have a 401(k) account managed by the fund company. 

Building a million bucks-sized nest egg doesn't happen overnight and is a result of workers who invest for the long term and put a chunk of their savings into stocks.

"Individuals are increasing their savings rates, they're taking advantage of their company match and they're keeping a healthy percentage of stocks in their account," says Jeanne Thompson, senior vice president at Fidelity Investments. "It takes many years of consistent saving and investing, but following these steps as part of a long-term retirement strategy can put an individual in a good position to eventually reach this savings milestone."

The broad U.S. stock market, which has been in a bull market for more than nine years, is up about 5 percent this year after posting a nearly 20 percent gain in 2017.

An additional 7,667 Fidelity IRA customers clocked in with $1 million-plus account balances in the April-thru-June quarter, boosting the number of  individual retirement account millionaires to 155,849, Fidelity said.

Ap Tax Overhaul Company Spending F File A Usa Tx
FILE - In this Sept. 24, 2013, file photo, just cut stacks of $100 bills make their way down the line at the Bureau of Engraving and Printing Western Currency Facility in Fort Worth, Texas. Big U.S. companies have been piling up cash for years, but have spent little of it on buying equipment and raising wages and other things to grow the economy. Republicans say they know how to fix this: Give companies even more money by cutting their taxes. (AP Photo/LM Otero, File) ORG XMIT: NYBZ239
AP

More Money: These are the country's best-paying jobs, with salaries over $100,000

More Money: Customers on front line of defense to prevent ATM cash-out heists worth millions

More Money: Ellen DeGeneres' new Walmart line of T-shirts, jeans and shoes won't cost over $30

News of the swelling ranks of 401(k) and IRA millionaires comes at a time when many Americans worry that they are not saving enough or some who aren't saving at all. 

For the 2018 tax year, workers younger than age 50 can set aside up to $18,500 of their salary in 401(k) plans, while employers 50 and older can contribute an additional $6,000 in catch-up savings.

Here are other highlights from Fidelity's quarterly analysis of retirement savings trends:

Average balances rise

The average 401(k) balance at the end of June was $104,000, up 6.4 percent from last year's second quarter, but below the record $104,300 balance from the final quarter of 2017. The average IRA balance jumped nearly 7 percent to $106,900.

Borrowing from 401(k) drops 

Fewer workers are using their 401(k) as a bank. The percentage of employees with an outstanding 401(k) loan dropped to 20.5 percent, the lowest since 2009. Better yet, the percentage of new loans taken out dropped for the second straight quarter.

'Auto enrollment' gains

The number of employers automatically enrolling new workers in 401(k) plans rose, helping to boost positive investment outcomes. Among large employers with 50,000-plus workers, 61 percent now sign their employees up automatically. 

Employees that are automatically put into the savings plan tend to stay invested in the 401(k) plan longer and they tend to save more. Average plan participation rates in the second quarter hit 87 percent for workers automatically enrolled, versus just 52 percent for those in plans without automatic sign-up.

Since 2008, the average savings rate of employees automatically put into a plan has increased to 6.7 percent of their salary, up from 4 percent, the study found.