There would need to be some actual violence involved to constitute terrorism. If you spy on some journalist and then us that info to catch him and cut him in pieces while he's still alive, then the dismemberment may be considered terrorism and the spying was aiding that terrorism; if you spy on many people and the end result is just that some officers laugh about their naked photos or deny them jobs or disallow crossing borders, then that's just "ordinary" mass surveillance with no relationship to terrorism.
The NSA does not illegally spy. Congress has given them large authorizations to collect data and they need FISA approval before tapping Americans. 99.9% of the good work that NSA does will never be seen by the public.