Khaled Meshaal, the head of Hamas, and other top officials from the Palestinian group have met with Saudi Arabia's King Salman and senior Saudi leaders, according to a Hamas source and a website linked to the group.
The meeting brought together top members of Hamas' political wing with the Saudi king, crown prince and defence minister in a possible rapprochement between the conservative US-allied kingdom and the traditionally Iran-allied gorup.
"The delegation discussed Palestinian unity and the political situation in the region," the Hamas source told the Reuters news agency.
"This meeting will hopefully develop relations between Hamas and Saudi Arabia."
A Hamas website said that Mashaal and the Saudi king attended prayers in the holy city of Mecca and that the two shook hands, the AP news agency reported.
Hamas has ruled the Gaza Strip since 2007 after fighting a brief and bloody civil war with Palestinian rivals in Fatah. Gaza has been subjected to major Israeli military operations three times since then.
The group was jolted by civil war and rivalries in the wake of the Arab Spring in 2011 and relations with Iran soured over its refusal that year to back Tehran's ally, Syrian President Bashar al-Assad, in his war against rebels.
Much of Hamas's senior leadership decamped to Qatar.
Relations between Hamas and Saudi Arabia have improved since Salman assumed the Saudi throne in January and the kingdom has taken on a newly assertive posture in the region.