Spanish police have captured a former British rapper who was on the run after fighting for the Islamic State (IS) jihadist movement in Iraq and Syria, officials and media said.