The country also boasts an excellent healthcare system.
The healthcare system in Spain ranks as one of the world's best.
All Spanish citizens have a constitutionally guaranteed access to the country's universal healthcare system, and less than 20% of residents choose to obtain private health insurance.
Spain is also a tight-knit country where people place great emphasis on family.
Antonio Abellán, who conducts research on aging at the National Research Council in Spain, told The Guardian that social relationships play a large role in Spaniards' longevity.
Spain is not the only Mediterranean country to value family so much, but Abellán said being close with one's relatives goes a long way for health.
"It's not the only thing — nor the most important thing — but I think it goes some way to explaining the differences between Spain and other countries," Abellán told The Guardian. "It's a bonus. If you live better, you end up living longer."
Spaniards drink more than Americans and residents of many other countries, but that hasn't stopped them from ranking high for longevity.
Despite moving toward the top of life expectancy rankings, people in Spain could benefit from smoking less.
Smoking cigarettes remains popular in Spain, even after the country passed a law in 2011 that prohibits smoking in bars and restaurants.
According to El Pais, there have been fewer cases of asthma among children since 2011, and the legislation may also result in fewer heart and lung illnesses.
Still, each Spanish person smokes an average of 1,499 cigarettes per year, according to Tobacco Atlas. The number is much higher than that of some countries, such as Norway's annual average of 553 cigarettes per person, but Spain is still ahead of Japan, where each person smokes an average of 1,583 cigarettes per year.