The gunmen were from the Al Aqsa Martyrs' Brigades, a violent offshoot of Palestinian President Mahmoud Abbas' Fatah Party. Fatah, which dominated Palestinian politics for decades, was defeated by Hamas in January parliament elections.
The previous Fatah-led government gave the gunman jobs and privileges, but Hamas has vowed to clean up promotion, reports CBS News correspondent Robert Berger.
About 20 Al Aqsa gunmen seized the three-story Cabinet building in Ramallah for about an hour, before members of the security forces persuaded them to leave. Many of the gunmen also work in the security forces.
Earlier Thursday, the group had shut down the Transportation Ministry, forcing employees to leave the building.
In other developments:
An Al Aqsa spokesman said the gunmen were upset over the refusal of the Hamas government to meet their demands. The spokesman, Kamal Saffaka, said that the previous government, run by Fatah, had awarded them hundreds of taxi licenses as perks. Each license is worth thousands of dollars.
The group also demanded that its members win promotions in the security forces.
Hamas had campaigned on a clean government platform. Many Palestinians voted for the Islamic militant group because they were fed up with widespread official corruption and the lawlessness of Fatah-linked gunmen.
In another sign of growing Hamas-Fatah tensions, a group of Fatah-affiliated gunmen briefly entered the Women's Affairs Ministry during a dispute between the Hamas minister and a disgruntled employee. The minister called the police and the gunmen left.