Spain has offered to take some of around 150 migrants on board a rescue ship that has been blocked from docking in Italy, the government in Rome said on Thursday.