Palestinians wave yellow Fatah flags during a rally in Gaza to mark the 48th anniversary of the founding of the Fatah movement. Photograph: Eman Mohammed/Demotix/Corbis

Hundreds of thousands of Palestinians have joined a mass rally in Gaza support of President Mahmoud Abbas's Fatah faction, in the first such demonstration in the territory since Hamas group took control in 2007.

Throngs camped out overnight in a downtown Gaza square to ensure themselves a spot for the anniversary commemoration of Fatah's 1959 founding, and tens of thousands marched early Friday, carrying yellow Fatah banners.

In a recorded speech, Abbas predicted the end of a five-year split between the two factions. "Soon we will regain our unity," he said.

Hamas, which does not recognise Israel's right to exist, expelled secular Fatah from Gaza during the war. It gave permission for the rally after the deadlock in peace talks between Abbas's administration and Israel narrowed the two factions' ideological differences.

The Palestinian rivals have drawn closer since Israel's assault on Gaza in November, in which Hamas, though battered, claimed victory.

Relations between the two factions have thawed since the fighting, and last month Hamas held its first rallies in the West Bank. Egypt has long tried to broker Hamas-Fatah reconciliation, but past efforts have foundered over questions of power-sharing, control of weaponry, and to what extent Israel and other powers would accept a Palestinian administration that includes Hamas.

An Egyptian official told Reuters that Cairo was preparing to invite the factions for new negotiations within two weeks.

Israel fears grassroots support for Hamas could eventually topple Abbas's Palestinian Authority (PA) in the West Bank.

"Hamas could seize control of the PA any day," Israeli prime minister Benjamin Netanyahu said on Thursday.

The demonstration marked 48 years since Fatah's founding as the spearhead of the Palestinians' fight against Israel. Its longtime leader Yasser Arafat signed an interim 1993 peace accord that won Palestinians a measure of self rule.

Hamas, which rejected the 1993 deal, fought and won a Palestinian parliamentary election in 2006. It formed an uneasy coalition with Fatah until their violent split a year later.

Though shunned by the west, Hamas feels bolstered by electoral gains for Islamist movements in neighbouring Egypt and elsewhere in the region – a confidence reflected in the fact Friday's Fatah demonstration was allowed to take place.

"The success of the rally is a success for Fatah, and for Hamas too," said Hamas spokesman Sami Abu Zuhri. "The positive atmosphere is a step on the way to regain national unity."

Fatah, meanwhile, has been riven by dissent about the credibility of Abbas's statesmanship, especially given Israel's continued settlement-building on West Bank land. The Israelis quit Gaza unilaterally in 2005 after 38 years of occupation.

"The message today is that Fatah cannot be wiped out," said Amal Hamad, a member of the group's ruling body, referring to the demonstration attended by several Abbas advisers. "Fatah lives, no one can exclude it and it seeks to end the division."