The case, known as the Heyday case, was brought by charities Age Concern and Help the Aged who argued that the UK's Age Regulations Act, in force since 2006, breached an EU directive.
The judge rejected the challenge but said there was a compelling case for the compulsory retirement age to rise, raising the prospect that it will be increased next year when the government is scheduled to review retirement legislation.
A spokesman for the age charities said they were "diappointed" with the High Court ruling, but said they will not appeal because they expect the law to change.
The current age regulation enables companies to force staff to retire at 65 even if they wish to carry on working, meaning that many companies can reduce headcount and costs without redundancy payments.
Carole Banwell, of BPIF Legal, claimed that the ruling would help employees to plan ahead. She said: "Businesses now have certainty in this area where for months there has been uncertainty. It also means they can make orderly succession plans for the future workforce of the business."