Spain just surpassed Italy as the world's healthiest nation. That's according to this year's edition of the Bloomberg Healthiest Country Index, which ranks 169 countries based on factors that contribute to overall health.

Six of the top 10 countries were in Europe, with Italy ranking second. In contrast, the United States didn't even break into the top 30, ranking at number 35, one notch worse than last year.

The top 10 healthiest nations, according to the report, were:

Spain Italy Iceland Japan Switzerland Sweden Australia Singapore Norway Israel

To come up with the rankings, Bloomberg researchers graded nations based on several factors including life expectancy, while giving penalties for health risks such as obesity and tobacco use. Environmental factors like access to clean water and sanitation were also taken into account.

Get Breaking News Delivered to Your Inbox

The results mirror other research that came out last fall looking at future life expectancies in 195 countries and territories around the world. In that study, published in the international medical journal The Lancet, Spain also ranked first, with a projected life expectancy of 85.8 years by 2040. The United States ranked 64th.

Experts say the eating habits of the Mediterranean diet may provide clues for why Spain and Italy enjoy such good health. This heart-healthy diet is rich in fruits, vegetables, fish and whole grains, along with healthy fats like olive oil, nuts and avocados.

A number of studies have shown the Mediterranean diet reduces the risk of heart disease and may have numerous other health benefits, including reduction of LDL, or "bad," cholesterol, as well as a decreased risk of Alzheimer's disease, Parkinson's disease and cancer. One study published in British Journal of Nutrition found that following a Mediterranean diet was associated with a 25 percent lower chance of death from any cause.

People in Spain also benefit from a national health system focused on preventative care, according to a review by The European Observatory on Health Systems and Policies, which praised its "principles of universality, free access, equity and financial fairness."

One of the main reasons the U.S. ranks so poorly compared to other developed nations is the obesity epidemic, which shows little sign of letting up. The latest figures from the Centers for Disease Control and Prevention estimate nearly 40 percent of American adults — equivalent to 93.3 million people — are obese.

Life expectancy in the U.S. has also been driven down in recent years due to so-called deaths of despair, including suicide and drug overdoses. For the first time, Americans were even more likely to die from opioid overdoses than car accidents.

Sub-Saharan Africa accounted for 27 of the 30 unhealthiest nations in the Bloomberg rankings. Haiti, Afghanistan and Yemen were also in the bottom 30.