Two other people have been wounded in the assault, in the remote community of Ad Dair, next to the border with Yemen.
The attacker has been arrested, an official said.
No motive has been given for the attack, and authorities say they are treating it as a criminal act.
The suspect has not been identified but the AFP news agency, quoting Al-Ekhbariya state TV, reported that the man was not an employee but had some business at the ministry.
Earlier reports suggested the attacker was a teacher.
Criminal mass shootings are rare in Saudi Arabia but the country has faced recent attacks by ISIS.
Saudi Arabia has led an air campaign against Shia Houthi rebels in Yemen and violence in the border region has been frequent in recent months.
Image source: Wikimedia Commons President-elect Donald Trump celebrated his election victory at the Ultimate Fighting…
Millions of voters across the US chose to return Donald Trump to the White House…
Donald Trump declares victory in the US election as he addresses jubilant supporters in Florida.…
Stocks around the world are rising as Donald Trump appears to be on the cusp…
Donald Trump has won Pennsylvania, North Carolina and Georgia and taken a lead over Kamala…
Quincy Jones, the celebrated musician and producer who worked with Michael Jackson, Frank Sinatra, Ray…