A gay man has won a landmark ruling which will give his husband the same pension rights as a wife would receive.
The Supreme Court unanimously ruled that if John Walker, 66, dies, his husband is entitled to a spouse's pension, provided they remain married.
The ex-chemical company worker said it would "drag" the government "into the 21st Century", while human rights group Liberty said "thousands" could benefit.
A government spokesman said it would review the implications of the ruling.
BBC legal affairs correspondent Clive Coleman said the decision will have "a dramatic effect on the entitlement of thousands of civil partners and spouses in same sex marriages".
They will now enjoy the same pension rights and entitlements as those in a heterosexual marriage, our correspondent added.
The ruling means Mr Walker's husband - who is in his 50s - would be entitled to a spousal pension of about £45,000 a year in the event of his death, rather than around £1,000 a year.
Mr Walker, a former Cavalry officer, said it was "to our government's great shame that it has taken so many years, huge amounts of taxpayers' money and the UK's highest court to drag them into the 21st Century".
He added: "Finally this absurd injustice has been consigned to the history books and my husband and I can now get on with enjoying the rest of our lives together."
What is the case about?
- Mr Walker worked for chemicals group Innospec from 1980 to 2003
- He made the same contributions to the pension scheme as heterosexual colleagues
- He entered a civil partnership with his now-husband in January 2006, which was later converted into a marriage
- However, Innospec refused to pay a full spousal pension, because Mr Walker's service began before 5 December 2005 - the date civil partnerships became legal in the UK
- Mr Walker won an employment tribunal in 2012 to secure his pension rights, but it was overturned on appeal by Innospec two years later
- That decision was upheld by the Court of Appeal in 2015
Mr Walker took legal action as he wanted to ensure that, should he die first, his husband would receive an adequate pension.
The majority of occupational pension schemes give 50% of the value of a pension to a spouse for the rest of their lives after their husband or wife dies - without taking the marriage date into account.
However, the Equality Act 2010 has an exemption for employers, allowing them to exclude civil partners from spousal benefits paid in before December 2005.
The Supreme Court has now ruled the exemption under the 2010 act is "incompatible with EU law and must be disapplied".
Emma Norton, a lawyer from Liberty, which represented Mr Walker, called on the government to promise Brexit would not threaten the ruling.
"This ruling was made under EU law and is a direct consequence of the rights protection the EU gives us," she said.
"We now risk losing that protection. The government must promise that there will be no rollback on LGBT rights after Brexit."
A government spokesperson said the rights of same sex couples had been "transformed for the better since 2010".
During the hearing, it said the cost of applying the ruling retrospectively would be £100m for private sector schemes and a further £20m for the public sector.