Ryanair said the six-year rule was "unnecessary and unreasonable" and that it would appeal against the decision.
The Supreme Court ruled last year that delayed passengers in England and Wales have six years to claim, but Ryanair says passengers who book with it accept their terms and conditions, and therefore the claim limit is two years.
But at Manchester County Court, Judge Platts ruled Ryanair could not use a clause in its small print to impose a limit.
Analysis by Simon Gompertz, BBC personal finance correspondent
Ryanair disputes the suggestion from some lawyers that it could be exposed to hundreds of millions of pounds worth of compensation claims from customers who suffered delays.
The airline says that even if its appeal against the Manchester County Court ruling is unsuccessful, its maximum potential liability is €5m (£3.6m).
The low figure is the result of the fact that, according to Ryanair, more than 90% of passengers affected by delays make a valid claim within two years.
That means that very few would need to submit one between two and six years after the event, even if they realised that they had the option.
Nevertheless, Ryanair and other airlines are deeply unhappy about the EU-wide system triggering payouts which can be way in excess of the cost of the ticket.
The consumer group, Which?, said airlines should hold their hands up and pay compensation where it is due.
Lawyers say the ruling stands to affect millions of air passengers, because if Ryanair had won, all airlines may have been able to impose a two-year time limit on all existing and future flight delay claims.
Passengers can claim between £180 and £440 for a delay of at least three hours, depending on the length of the wait and the distance to be travelled.
The Independent's travel editor, Simon Calder, said airlines were "absolutely furious" with the ruling.
He added: "They say it's tough running an airline. Things occasionally go wrong, but to give people - as they put it - free money seems totally disproportionate."
Legal firm Bott & Company, based in Wilmslow, Cheshire, which represented the two passengers who brought the case against Ryanair. It says the ruling could potentially total up to £610m of past claims for Ryanair - although the airline disputes this assessment.
The firm's Kevin Clarke said: "We're delighted that the court has dismissed yet another argument put forward by the airlines to restrict passenger rights.
"We fully expect the airlines to continue to fight these cases but we are prepared to hold them to account in each and every instance where the law says compensation is payable, and with the courts continuing to find on behalf of consumers we've real cause to be optimistic that passengers will receive the compensation they are entitled to."
Ryanair said in a statement: "We note this ruling which reverses lower court orders that a two-year time limit for claims is reasonable.
"Since we believe a six-year time limit for submitting such claims is both unnecessary and unreasonable, we have instructed our lawyers to immediately appeal this ruling."
Jenny Fletcher has a claim in progress for compensation from Ryanair after her flight from Granada in Spain to Stansted Airport was delayed, and then transferred to depart from Malaga instead.
She said: "It's fantastic news. I'm so pleased that this has finally got approval. Groups of people have had their holidays completely ruined, and now there's finally a bit of hope for us."
Ryanair has told the BBC it would not comment on Ms Fletcher's case, as it is still going through the courts.