You can move to Spain and work there, provided you have a valid work visa or residence permit. The type of work visa you need may differ depending on the country you are applying from and the type of job role you were offered in Spain.