An illegal migrant has been arrested on suspicion of raping a woman who went for an early-hours dip at a Spanish beach.