Qatar's emir has called for Arab unity on the first visit to Gaza by a head of state since Hamas took power in 2007.
Sheikh Hamad bin Khalifa al-Thani urged the Islamist group and rival Palestinian group Fatah, which holds power in the West Bank, to reconcile.
He pledged $400m (£250m) for building projects in the Gaza Strip, which has been ravaged by conflict with Israel.
Israel, which says Hamas is a terrorist group, said the emir's support for the Islamists "threw peace under a bus".
Hamas Prime Minister Ismail Haniya said the trip had broken Israel's economic and political blockade of Gaza.
He said the visit showed Gaza was "not alone".
The Palestinian Authority expressed reservations about the emir's visit, after President Mahmoud Abbas phoned the sheikh earlier this week to emphasise he was the internationally recognised leader of the Palestinians.
Qatar has become one of Hamas' main benefactors since it fell out with Syria and relations cooled with Iran.
'Sit together, brothers'
The Qatari leader was given a hero's welcome as he entered Gaza by car via the Rafah Crossing from Egypt amid tight security, to be greeted and embraced by Mr Haniya before a guard of honour ceremony outside an elaborate desert-style tent.
"Your visit today officially announces the break of the economic blockade and political blockade imposed on the Gaza Strip by the forces of injustice," said the Hamas prime minister.
For his part, the emir of Qatar used the landmark visit to call for warring Palestinian factions to unite.
"Why are you staying divided?" he asked an audience at Gaza's Islamic University. "There are no peace negotiations, and there is no clear strategy of resistance and liberation. Why shouldn't brothers sit together and reconcile?"
Hamas, which won parliamentary elections in 2006, ousted forces loyal to Palestinian Authority President Abbas in Gaza during clashes in 2007 and set up a rival government.
In response, Israel tightened its blockade on the coastal territory, which has had a crippling effect on Gaza's economy.
The emir's speech had been scheduled to take place at a major rally in Gaza City's 40,000-seat football stadium, but that event was called off at the last minute amid reports the stadium was sparsely filled.
Hamas officials said the sheikh's busy schedule was responsible for the cancellation: During his four-hour visit, the emir launched housing and hospital projects and received an honorary degree.
Israeli officials seemed bemused by the visit.
"This is more than strange, especially since Hamas is internationally recognized as a terror group," said Israeli Foreign Ministry spokesman, Yigal Palmor.
"By hugging Hamas publicly, the emir of Qatar has thrown peace under the bus."
Qatar, one of the richest countries in the Arab world, has become an important source of revenue for Hamas in the aftermath of its fallout with Syrian President Bashar al-Assad.
In February, Hamas announced that its political leadership had been moved from Syria to Egypt and Qatar, because it could no longer effectively operate amid the unrest in Syria.
Source: BBC News