The Interior Ministry said they have a profile that is similar to the two suspects in the Boston Marathon bombings, CNN reported Tuesday.
Nou Mediouni of Algeria and Hassan El Jaaouani of Morocco were radicalized though online forums and chat rooms, a ministry spokesman said.
The spokesman said the two suspects also checked out bomb making on the Internet.
Both have reportedly been in contact with Islamic extremists in Mali.
The two North African men were under surveillance as part of an operation run in cooperation with France and Morocco.
Their arrest comes just days before Sunday's Madrid Marathon. Some 26,000 runners are expected to take part.
Ukrainian protestors topple Lenin statue [VIDEO]
Wisconsin business offering 'therapeutic cuddling' forced to close