The court said the suspects also were planning to cause an explosion at a basilica within the monastery of Montserrat, near Barcelona, that would have caused "terrorist havoc."
A court statement said the Chileans were arrested Wednesday in Barcelona on suspicion of being part of the "extremely dangerous" Mateo Morral Commando anarchist group.
Documents relating to the group were seized during a search of the apartment the two Chileans shared, Velasco said. Two gas cylinders also were impounded by police, the judge said.
Velasco ordered the Chileans to be held in custody awaiting trial.
Three other suspects were arrested Wednesday and later released, including an Italian woman, 34-year-old Valeria Giacomoni, who allegedly collaborated with the Chilean suspects. The three were ordered to surrender their passports and report daily to police pending further investigations.
The Chileans have been investigated in their country for similar actions, including one at the Los Sacramentos de Santiago de Chile church in 2009, according to Spain's interior minister, Jorge Fernandez Diaz.