Assad's office published images of him praying inside the brightly-lit Al-Nuri mosque at dawn on Sunday before greeting worshippers outside.
He was flanked by Islamic Endowments Minister Mohammad Abdel-Sattar Sayyed and Syria's top Muslim cleric Ahmad Badredine Hassoun.
Eid al-Fitr marks the end of the holy month of Ramadan, during which Muslims fast from dawn until dusk.
Signup to our newsletter and follow us on Facebook and Twitter!
Ahead of the holiday, Syria's government released more than 670 detainees -- including some children born to prisoners -- from jails around Damascus on Saturday.
Assad's last public appearance outside Damascus was during Eid al-Fitr in July 2016, which he spent in third city Homs.
Presidential trips outside the capital have become rare since Syria's conflict broke out more than six years ago.
Hama city is the capital of the governorate by the same name, where Syrian government troops are battling jihadists and their rebel allies.