The February 2 polls, called by Prime Minister Yingluck Shinawatra in an unsuccessful attempt to ease a months-old political crisis, have not yet been completed because of disruption by demonstrators.
A court spokesman told reporters that the 6:3 ruling was reached on the grounds that voting was not held for the entire country on the same day.
Opposition protesters blocked candidate registrations in 28 constituencies, and also caused the closure of about 10 per cent of polling stations.
The main opposition Democrat Party boycotted the vote, saying it would not end years of political turmoil.
The case was one of a slew of legal hurdles facing Yingluck, who has withstood calls to resign despite months of political street protests.
A spokesman for her Puea Thai Party described the outcome as "regrettable", and said the annulment of the vote would "set a bad precedent".
Yingluck's government, in a caretaker role following the incomplete election, faces a series of legal challenges that could lead to her removal from office, including negligence charges linked to a rice subsidy scheme.
She has faced more than four months of street demonstrations seeking to force her from office and install an unelected government to oversee reforms and curb the dominance of her billionaire family.
Twenty-three people have been killed in recent weeks in gun and grenade attacks, mostly targeting protesters.
It is the latest chapter in a political crisis stretching back to a military coup in 2006 that ousted Yingluck's brother Thaksin Shinawatra, a divisive tycoon-turned-politician who lives in Dubai to avoid prison for a corruption conviction.