The government's National Cyber Security Centre said the attack involved the use of "Powershell" malware, but it did not comment on the source of the attack or which government bodies were targeted.
UK parliament under cyberattack
"The NCSC has detected a new Advanced Persistent Threat (APT) that is targeting Saudi Arabia," the agency said in a statement, adding the attack sought to infiltrate computers using email phishing techniques.
Saudi Arabia has come under frequent cyber-attacks, including "Shamoon", the aggressive disc-wiping malware employed in attacks against the Saudi energy sector in 2012.
Massive cyber-attack hits nearly 100 countries
Saudi Aramco, the world's biggest oil company, was among the firms hit by Shamoon, in what is believed to be the country's worst cyber-attack yet.
US intelligence officials at the time said they suspected a link to the kingdom's regional rival Iran.
COMMENTS
Comments are moderated and generally will be posted if they are on-topic and not abusive.
For more information, please see our Comments FAQ