Judge Fernando Andreu ruled on Thursday that he was competent to handle the case under the principle of universal jurisdiction - which allows courts to try certain atrocities committed in other countries -- because the case concerns a Spanish nun who is a victim of the group.
Spanish public prosecutors accused Boko Haram in their lawsuit of "harassing" and "putting pressure" on the nun in March 2013 in Nigeria as part of "a generalised context of actions of a terrorist nature by the jihadist organization".
"Many civilians, especially women and children, have been killed, kidnapped and forcibly recruited by Boko Haram. The culprits must answer for their acts before the courts," prosecutors wrote in their lawsuit.
"What the group has done is barbaric," Javier Zaragoza, the chief prosecutor at the High Court, told AFP.
The judge asked Interpol to prepare a report on Boko Haram and ordered the nun, Maria Jesus Mayor Garcia, to appear in court for questioning.
Boko Haram has killed thousands of people in Nigeria during a six-year insurgency to carve out an Islamic caliphate. It has also staged cross-border attacks in Chad, Cameroon and Niger.
The Islamist uprising has left more than 15,000 people dead since 2009 and forced another 1.5 million from their homes.