An Egyptian court on Saturday quashed a February decision by another tribunal branding the Palestinian Islamist movement Hamas a "terrorist" group, a court official said.
He told AFP that the earlier ruling was thrown out because the court that issued it was not "competent" to make such verdicts.
The February ruling came after a lawyer petitioned the court to classify Hamas as a terrorist organisation, accusing it of using underground tunnels to smuggle weapons into Egypt.
But in March the government appealed against the ruling, which took ties between Hamas and Egyptian authorities to a new low.
The Islamist movement had strongly condemned the February verdict -- which came a month after another court ruled Hamas's armed wing, the Ezzedine al-Qassam Brigades, a "terrorist group".
Egypt is a traditional broker between Israel and Hamas.
On Saturday, the group issued a brief statement saying that the new ruling corrects "a wrong decision".
Signup to our newsletter and follow us on Facebook and Twitter!
"Hamas welcomes the Egyptian court's decision," it added.
Relations between Cairo and Hamas deteriorated after the 2013 ouster of Islamist president Mohamed Morsi by Egypt's then army chief and now President Abdel Fattah al-Sisi.
Ties further worsened after the authorities outlawed Morsi's Muslim Brotherhood movement, of which Hamas is an affiliate.
Egyptian authorities have accused Hamas of backing jihadists who have carried out deadly attacks on security forces in the Sinai Peninsula that borders the Hamas-ruled Gaza Strip.
The army says it has destroyed hundreds of tunnels used for smuggling supplies and arms between Sinai and Gaza, and also used by militants to infiltrate into Egyptian territory.
In March 2014, Egypt banned all Hamas activities on its soil and froze its assets.