"They publicly and repeatedly expressed on social networks their support for the terrorist group Daesh, its methods and its Salafist-jihadist ideology," the Civil Guard said in a statement.
Daesh is an alternative name for Islamic State, which is also known by the acronyms of ISIS and ISIL.
The Civil Guard gave the ages of the pair as 31 and 35, but did not name them. They were arrested in the tourist town of Sant Antoni de Portmany.
They were "imams in a mosque, a privileged position from which to exert influence over members of the Muslim community on the island," the Civil Guard said.
It added there was particular concern about the impact their teachings may have had on youngsters at the mosque.
The Spanish authorities have arrested 156 people since 2015 on suspicion of being jihadists.