There are two parts to this, and usually they are done by separate agencies. The first part is to collect information (to "spy") on other countries. The other side is to watch people in the home country who might cause problems. A third activity is to defend against foreign intelligence agencies in the home country. This is called counter-intelligence, and is often done by a separate agency.
The methods of information gathering are sometimes covert (hidden) and sometimes quite open. A covert method might be to steal and copy secret documents. An open method would be to read all published work on some important matter, and analyse it. Much important material is published openly in democratic countries.
To get hold of secret information, these organisations use espionage, intercept signals (tap phones, hack computers), cryptanalysis (break codes), and think about what the information means. Putting together and communicating information is known as intelligence analysis and assessment.
Some agencies have been involved in assassination, arms trafficking, coups d'état, and the placement of misinformation (propaganda) as well as other covert operations, in order to support their own or their governments' interests.
- SIS The Secret Intelligence Service, usually called MI6. Collects intelligence ("spies on") from other countries.
- The Security Service, usually called MI5. Does counter-intelligence against foreign threats.
- GCHQ Government Communication Headquarters. Intercepts signals, decodes them, passes the information on to other agencies. The home of cryptanalysis, the successor to Bletchley Park.
- Joint Intelligence Committee. Informs government as to what is going on.
- Cabinet Intelligence and Research Office
- Defense Intelligence Headquarters
- Public Security Intelligence Agency
The United States has about 17 major intelligence groups, and many other smaller groups. These are the most important:
- CIA: The Central Intelligence Agency. Spies on foreign countries, and takes covert action against enemies of the U.S. abroad.
- Defense Intelligence Agency
- National Security Agency. Interception and Cryptanalysis of foreign communication, and protecting US communication from same.
- United States Intelligence Community is the coordinating group for government intelligence agencies, headed by the Director of National Intelligence.