No group immediately claimed responsibility for the attack on Monday, which came amid protests by groups opposed to Brazil hosting the World Cup in June and July.
Police and government security teams were investigating the extent of the attack. The ministry shut down its email communications for a day.
The spokesman said sensitive information sent through the email system was encrypted, but employees at the ministry and Brazilian embassies abroad were told to change their passwords.
Brazil in April passed comprehensive Internet privacy legislation in what some liken to a Web-user's bill of rights, after stunning revelations its own president was targeted by US cyber-snooping.
"The bill sets out principles, guarantees, rights, and duties for Internet users, and Internet service providers" in Brazil, a statement on the Senate's website had said.
Also in April, Brazil held the NETmundial conference for global leaders and the biggest Web firms to discuss Internet legislation.
Big Internet companies were the clear winners at the global conference on the future management of the Web where most participants agreed it should remain a self-regulated space free of government intervention.
Convened by President Dilma Rousseff after revelations of U.S. surveillance undermined trust in the Internet, the NETmundial conference concluded that governments, companies, academics, technicians and users should all have a say in where to go next.
Written with agency inputs
Get your daily dose of tech news, reviews, and insights, in under 80 characters on Gadgets 360 Turbo. Connect with fellow tech lovers on our Forum. Follow us on X, Facebook, WhatsApp, Threads and Google News for instant updates. Catch all the action on our YouTube channel.
Supernova’s First Moments Show Olive-Shaped Blast in Groundbreaking Observations