The man had an "arsenal of weapons" at his home in the town of Terrassa, Catalan police said on Twitter, including more than a dozen firearms, sniper rifles and a submachine gun.
According to local media, the man had threatened to assassinate the prime minister on social media, vowing to take revenge for the government's controversial plan to exhume the late Spanish dictator Francisco Franco.
Read more: Spain hears first-ever court testimony of Franco-era crimes
'Clear intention'The arrest took place in September but was first reported Thursday by Spain's Publico newspaper. The suspect, a former private security guard, remains in custody but has not been charged.
"This person had a clear intention and will to take actions against the prime minister and he was only lacking logistical support," Catalan regional police spokesman Albert Oliva told journalists.
Spain's government said in a statement that the prime minister's security had "never been compromised," and that the assassination plan was an "isolated incident."
Read more: Spain to outlaw groups honoring dictator Francisco Franco
Since coming to power in June, Sanchez has made it a government priority to relocate Franco's remains from a huge mausoleum at the Valley of the Fallen memorial site where he was laid to rest after his death in 1975. The prime minister wants to move the embalmed corpse to a more discreet site where it will be harder for the dictator's followers to pay tribute.
nm/aw (AFP, dpa)
Every day, DW editors send out a selection of the day's hard news and quality feature journalism. You can sign up to receive it directly here.