Espionage grants you the ability to spy on other countries or protect yourself from being spied on. It is located on the left side of your screen.
Select a foreign province you want to assign a spy to and decide between Intelligence, Economic Sabotage and Military sabotage. Recruiting a new spy costs 15.000$, and the spy also has a daily money upkeep depending on his assigned role.
Counter Espionage Spies counter and reveal enemy spy activity on your territory.
Intelligence Spies gather information about the enemy's diplomatic relations and economical activities.
Economic Sabotage Spies damage the morale in the province they're put in, as well as destroy resource production.
Military Sabotage Spies try to reveal and interfere with the enemy's military plans and infrastructure.
To protect yourself from enemy spies, select one of your provinces that you want to protect and assign Counter Espionage spies.
It is also possible to instantly get the benefits of spies by using instant actions. These are special agents which cost Gold to use and are only performing their action once, but with a 100% success rate.
It is worth noting that if you just want to reveal specific enemy units in the vicinity you can also use the patrol function of air planes, which reveals hidden troops as well. Both spies and patroling airplanes are also able to uncover troops which are concealed by high level fortresses (units appearing with a "?" question mark).