Assange, who is currently serving time at a high-security prison in Britain, answered questions from a judge at Spain's National Court in Madrid, testifying by videoconference from Westminster Magistrates Court in London, his legal team said.
Spain's top criminal court is investigating whether Undercover Global Ltd, which was responsible for security at the embassy, spied on 48-year-old Australian and passed on information to the United States.
The case is key to Assange's efforts to fight an extradition request by the US Justice Department which is pushing to have him put on trial for leaking hundreds of thousands of secret US military and diplomatic documents in 2010.
The documents exposed US rights abuses including the unreported killing of Iraqi civilians, but also put sources named in the documents at risk and were used to weaken democratic alliances.
“We are pleased that Mr. Assange was able to express himself regarding this alleged spying which was supposedly coordinated from the United States,” one of his lawyers, Aitor Martinez, told reporters outside the Madrid court after Assange testified.
“Given the evidence that has been submitted, we feel that obviously the extradition request against him should be rejected because there are no guarantees in the United States” that his rights will be respected, he added.
Assange's legal team argues he was “subjected to widespread interference on a massive scale by the American authorities, violating his confidential communications with his lawyers, among other rights.”
“The information gathered by this firm — through the alleged use of video cameras which also captured audio, hidden microphones, copying identity documents, monitoring the electronic devices and mobile phones of visitors, among other things — ended up in the hands of the US intelligence services.”
There was a “huge body of evidence” to back the claim, coming from both company data as well as from protected witnesses who were formerly employed by the firm, the source said.
As well as installing cameras, Undercover Global is suspected of installing microphones in places as diverse as the base of a fire extinguisher and in the women's toilets, where Assange held many meetings for fear of being spied on.
They were allegedly able to record discussions with his lawyers as well as details of medical visits, with the information then transferred to servers that were accessible to the US intelligence services.
Assange took refuge inside the Ecuadoran embassy in 2012, fleeing what he claimed was a politically-motivated extradition order for his return to Sweden for questioning in a sexual assault case, which was dropped last month.
After Quito gave him up in April, Assange was arrested and is currently serving 50 weeks in a London jail for breaching his bail conditions when he entered the embassy.
He is also fighting a request to extradite him to the United States where he faces 18 charges, mostly relating the obtention and dissemination of classified information over WikiLeaks' publication of military documents and diplomatic cables.
Assange is “very tired” as his “health is very fragile,” Martinez, his lawyer in Spain said.
He recalled that the United Nations special rapporteur on torture warned last month that Assange's health was so bad that his life was “now in danger”.
Friday's hearing came at the request of the National Court, which is investigating both Undercover Global and its owner David Morales, who was arrested in September but is out on conditional release.