Spokeswoman for the military alliance Oana Lungescu said on Twitter that the websites had been hit by "a significant DDoS (denial of service) attack", but that it had had "no operational impact".
Under DDoS attacks, hackers hijack multiple computers to send a flood of data to the target, crippling its computer system.
Lungescu said experts were working to restore normal function but the websites remained down for hours and still could not be accessed at around 0430 GMT on Sunday.
Lungescu did not say who was responsible for the attack, which was claimed by a Ukrainian hacker group called Cyber Berkut, the name given to the feared elite riot police involved in a bloody crackdown on protesters in Kiev.
In a statement on its website www.cyber-berkut.org, the group said it had targeted three NATO websites over what it claimed was the alliance's interference in Ukraine and support of the "Kiev junta".
"We will not allow the presence of NATO in our homeland," said the statement, which could not be independently verified.
Ukraine has been shaken by turmoil that saw a bloody street revolt oust pro-Russian president Viktor Yanukovych in February as anger exploded over his rejection of closer ties with the European Union in favour of Moscow.
Moscow sparked anger after it sent its forces to occupy the majority Russian-speaking Black Sea peninsula of Crimea, where regional authorities declared independence and will hold a referendum on Sunday on whether to leave Ukraine and join Russia.
NATO and its members have spoken out strongly against the vote, which has escalated East-West tensions to their worst point since the Cold War.
The electronic attack is the latest of several that have seen Ukraine tensions hit cyberspace.
On March 8, British-based BAE Systems said dozens of computer networks in Ukraine had been infected by an aggressive new cyber weapon called Snake, which experts said was most likely the work of Russian hackers.
AFP