These pairings are more likely to go the distance, particularly if neither has been divorced in the past, according to the Bath University team.
The findings predicted a happy future for pop star Beyonce Knowles and rapper husband Jay-Z, 39 who got hitched at the ages of 28 and 39 respectively.
The work is published in the European Journal of Operational Research and reported on the BBC website.
The researchers studied interviews of more than 1,500 couples who were married or in a serious relationship.
Five years later, they followed up 1,000 of the couples to see which had lasted.
They found that if the wife was five or more years older than her husband, they were more than three times as likely to divorce than if they were the same age.
If the age gap is reversed, and the man is older than the woman, the odds of marital bliss are higher.
Add in a better education for the woman – Beyonce has her high school diploma, unlike husband Jay-Z – and the chances of lasting happiness improve further.
Those who have never divorced fare better too. But couples in which one member has been through a divorce in the past are less stable than those in which both members are divorcees.
Dr Emmanuel Fragniere and colleagues do say that men and women choose partners “on the basis of love, physical attraction, similarity of taste, beliefs and attitudes, and shared values.”
But they say that using “objective factors” such as age, education and cultural origin “may help reduce divorce”.