Authorities took counter-measures but failed to halt the attack, which left the sites periodically inaccessible from 10 a.m. (0900 GMT), her spokesman Steffen Seibert said. Screens gave Internet users error messages instead.
It was believed to be the first successful prolonged attack on the government's websites, which intelligence agency officials say face about 3,000 such hacker assaults daily.
The head of the BfV domestic intelligence agency said recently about five of the daily attacks came from foreign intelligence agencies.
Wednesday's hacking, which also knocked out the foreign ministry's website, came just before a meeting in Berlin between Ukraine's Prime Minister Arseny Yatseniuk and German President Joachim Gauck. Yatseniuk will meet Merkel on Thursday.
"Our service provider's data centre is under a severe attack that has apparently been caused by a variety of external systems," Seibert told a news conference when asked if Ukrainian hackers were responsible.
He said he had no other details. Germany has been a firm supporter of Kiev throughout its confrontation with Russia, which Kiev accuses of aiding armed separatists in eastern Ukraine.
In a statement on its website, a group calling itself CyberBerkut claimed responsibility.
"Berkut" is a reference to the riot squads used by the government of Ukraine's former pro-Russian President Viktor Yanukovich, who was ousted during violent protests last February.
"CyberBerkut has blocked German Chancellor and the Bundestag's (lower parliamentary house) websites," it said.
The claim could not be independently verified.
"We appeal (to) all people and (the) government of Germany to stop financial and political support of criminal regime in Kiev, which unleashed a bloody civil war," it said.
The attack comes after U.S. investigators said they believed North Korea had probably hired hackers to help with a massive cyber-attack against Sony Pictures. North Korea blamed the United States for Internet outages it suffered soon after.
Seibert said the goal of Wednesday's hackers was evidently to overload servers that administer the government's websites such as http://www.bundeskanzlerin.de, http://www.bundesregierung.de and http://www.cvd.bundesregierung.de.
The websites, which include general information, speeches and podcasts from the chancellor and general government information, are used by journalists and the public.
© Thomson Reuters 2015