Authorities said suspected Kurdish militants set off explosives and opened fire at the state-run space and defense company TUSAS on Wednesday.
Interior Minister Ali Yerlikaya said the two attackers – a man and a woman – were killed in the incident, while at least 22 people were injured.
In an X post on Wednesday evening, Sir Keir Starmer offered his condolences to the families of the victims.
He said: “I am horrified by the terrorist attack in Ankara.
“We stand side by side with Turkey as a NATO ally and close friend.
“Our thoughts are with the families of the victims and all those affected.”
Turkish President Recep Tayyip Erdogan called the attack “heinous”, while a statement from the US Embassy said Washington “strongly” condemned the attack.