Adrian Hong Chang, a Mexican citizen who lives in the US, contacted the US agency after fleeing to the US via Lisbon, Judge José de la Mata said.
The assailants interrogated an embassy official and tried to persuade him – unsuccessfully – to defect, he added.
The group shackled, beat up and interrogated several staff inside.
According to the judge’s edict, lifting the shroud of secrecy over the incident, Mr Hong Chang “contacted the FBI in New York five days after the assault, to give them his version of what happened there”. He is also said to have handed over audiovisual material.
The break-in on 22 February occurred just days before a key summit between US President Donald Trump and North Korean leader Kim Jong-un in Hanoi, Vietnam.
In the edict quoted by Spanish media, investigative magistrate De la Mata named two other members of the break-in group: US citizen Sam Ryu and a South Korean, Woo Ran Lee.
Alleged dissident group
The judge said that while holding embassy staff hostage for several hours the group stole a mobile phone, computers, hard disks and USB pen drives.
Spanish TV channel La Sexta has released a video purporting to show the “dissident” group smashing portraits of North Korea’s communist leaders inside the embassy. The source of that video has not been clearly identified.
One woman managed to flee, escaping through a second floor window and screaming for help. Concerned neighbours quickly called the police.
But when officers arrived they were greeted by Adrian Hong Chang, posing as a North Korean diplomat – he was wearing a jacket with a Kim Jong-un lapel badge. He told the police that all was well and nothing had happened.
That evening most of the group fled the embassy using three North Korean diplomatic vehicles, the judge said. Adrian Hong Chang and some others left later via the back entrance using another vehicle.
The break-in began at 16:34 (15:34 GMT) and most of the intruders fled at 21:40. They split up into four groups and headed to Portugal.
Mr Hong Chang had got access by asking to see the embassy’s commercial attache, whom he claimed to have met previously to discuss business matters, the judge said. His accomplices burst in once he had got access.
In his edict, the judge said the intruders had interrogated the commercial attache and tried to persuade him to defect. They left him tied up in the basement when he refused.
The judge said the group had “identified themselves as members of a human rights movement seeking to liberate North Korea”.
Who is behind it?
Authorities have dismissed the idea that common criminals are behind the alleged attack. Sources close to the investigation reportedly told El País that the operation was planned perfectly, as if by a “military cell”.
And the attackers seemed to know what they were looking for. Both Spain’s El País and El Confidencial dailies report that the Spanish authorities suspect US intelligence agencies and their allies could have been involved in the attack.
Victims of the alleged assault have reportedly told investigators the attackers spoke in Korean.
El País even reports that two of the group have links to the US Central Intelligence Agency (CIA). The CIA declined to comment to the BBC.
Asked if there was any US government involvement in the raid, State Department spokesman Robert Palladino told a regular news conference on Tuesday: “The United States government had nothing to do with this.”
Why would anyone attack the embassy?
Reports say the attackers could have been looking for information on North Korea’s former ambassador to Madrid, Kim Hyok-chol, expelled from Spain in September 2017 over North Korea’s nuclear-testing programme.
But Mr Kim is now serving as a key envoy in North Korean talks with the US, and helped organise the summit in Vietnam. He also travelled to Washington DC with Kim Jong-un’s right-hand man, Kim Yong-chol, in January.