If you're an American, forget it, you'll never be employed as a spy by your own government. They're very strict about that; they hate having to exchange captured spies with other countries, so they avoid using US citizens in undercover roles abroad.
The closest you can get to being a spy in the CIA is to be a case officer. Those are the guys who go overseas to recruit and collect intel from the spies.
In the FBI, you can't be a spy at all.
In the military, you could be a sniper, which might bring you close to enemy territory to gather intelligence. But not a spy.
So to be a spy, the best option is to work for a foreign government. It is very dangerous though. If you spy on the US for the Mossad or something, they'll throw you in prison if they catch you.