Joshua Bowles, 29, attacked the woman – who has not been named – outside the leisure centre which is just a few miles from GCHQ headquarters on March 9.
At the Old Bailey, Bowles admitted attempted murder and assault occasioning actual bodily harm against a man who intervened after the stabbing.
The court heard that Bowles had also been an employee at GCHQ and he had researched the victim and other US nationals who worked at the site, but was no longer working there at the time of the attack.
Bowles has been remanded in custody until sentencing at a later date.
“This extremely violent attack against two innocent people was completely unprovoked”, said Nick Price, Head of the CPS Special Crime and Counter Terrorism Division.
“It is right that those who commit violent crimes like this should be prosecuted to the full extent of the law to protect the public, and our thoughts continue to be with the victims and their families.”
GCHQ is the UK’s intelligence, security, and cyber agency, and regularly hosts agents from allied nations.
At an earlier hearing, it was revealed the woman was leaving the leisure centre with a friend when she was confronted by Bowles, who was armed with two knives, at around 9.15pm on March 9.
“This was a serious incident of attempted murder, this was a planned attack”, said prosecutor Kathryn Selby.
“The defendant has researched the victim and her whereabouts believing her to work for GCHQ. He has then travelled to the leisure centre taking with him two knives.
“He saw his victim enter the centre and waited outside. When she came outside with a friend he has gone up to her and attacked her with a knife.
“We believe he selected the victim because she is a worker at GCHQ and he holds views on the work he believes they conduct there. He attacked her because in his mind she represents the State.”
The woman suffered wounds to her abdomen, liver, leg, and chest, and was rushed to hospital for treatment in intensive care.
The CPS told the court Bowles, who lives in Cheltenham “told witnesses that he attacked the victim because he believes that she works at GCHQ”.
In the days after the stabbing, while in custody, Bowles issued prepared statements admitting being at the leisure centre, as well as his “motivation for the attack and his rationale for the victim being his target - confirming that it was because he believes that the victim works at GCHQ, and he disagrees with the work that he says that they conduct.”
It is also understood Bowles suffers from mental health issues.