Experts say the improvements of recent generations are likely to slow down because of health problems like obesity, diabetes, high blood pressure, alcohol and tobacco.
The global health forecasts were made by researchers from the University of Washington's Institute for Health Metrics and Evaluation.
In research published in medical journal The Lancet, they revealed people in every country in the world are likely to live longer in 2040 than they do now.
But the scientists predict there will be a rise in the number of people dying from non-contagious diseases like cancer and lung and kidney disease.
How quickly countries' life expectancies rise will depend on how well governments deal with these growing health threats.
"Inequalities will continue to be large," said researcher Dr Christopher Murray.
"In a substantial number of countries, too many people will continue earning relatively low incomes, remain poorly educated and die prematurely.
"But nations could make faster progress by helping people tackle the major risks, especially smoking and poor diet."
Beneath Spain in the top 10 will be Japan, with a 2040 life expectancy of 85.7 years, Singapore (85.4), Switzerland (85.2), Portugal and Italy (84.5), Israel (84.4), France (84.3), and Luxembourg and Australia (84.1).
All the countries are in the current top 10 for life expectancy, except Portugal and Israel which are predicted to replace Andorra and Iceland, currently sixth and ninth.
African countries continue to have the worst rates of premature death with people in the Central African Republic, Lesotho, Somalia and Zimbabwe still expected to die before the age of 65 by 2040.
The bottom 10 in 2040 will consist of the Central African Republic (58.4), Zimbabwe (61.3), Somalia (63.6), Swaziland (65.1), Afghanistan (65.2), Kiribati (65.7), Micronesia (66.2), Papua New Guinea (66.3) and the Solomon Islands (66.5).
The average lifespan in the UK is set to increase from 80.8 years to 83.3, moving Brits up the world league table from 26th to 23rd.
Figures from the Office for National Statistics last month showed there was virtually no extension of life expectancy between 2015 and 2017.
It is the first time since modern measurements were launched nearly 40 years ago that life expectancy has stalled.
Researchers from the University of Washington are slightly more optimistic, predicting that if trends continue as they are, the average person in the UK will live a year longer with each decade that passes.
But average life expectancy in the US, one of the world's richest nations, is forecast to increase by only 1.1 years to 79.8.
Experts suggest this is likely the result of more obesity-related diseases, such as heart disease and several cancers.
Study author Dr Kyle Foreman said countries could change their outcomes with better public health initiatives.
He said: "The future of the world's health is not pre-ordained, and there is a wide range of plausible trajectories.
"But whether we see significant progress or stagnation depends on how well or poorly health systems address key health drivers."
To make the predictions, scientists looked at the impact of 79 health factors including smoking, body mass index (BMI), and lack of clean water and sanitation on causes of death around the world.
In 2016 – the last time the study was carried out – four of the top 10 causes of premature death were non-communicable diseases and injuries.
The new forecast shows that by 2040 this figure increases to eight with heart disease, stroke, chronic lung disease, chronic kidney disease, Alzheimer's disease, diabetes, lung cancer and road accident injuries are all in the top 10 causes of premature death in 2040.