The white ship belonging to Spanish NGO Proactiva Open Arms arrived in the southern port of San Roque, just over the bay from Gibraltar, at 9:20am (0720 GMT).
The migrants, nearly all from Sudan including Darfur, had spent 50 hours at sea on board an inflatable boat, without drinking water, and many suffered burns from a mixture of fuel and salt water before they were rescued on August 2nd.
There were 75 men and 12 boys.
The NGO says many of them were "repeatedly abused in Libya."
San Roque is where Spain hastily opened a new migrant reception centre as hundreds of migrants make the perilous sea crossing to the southern coast of Andalusia every week.
Faced with a crackdown by Libyan authorities and Italy's hardline approach to the arrival of migrants, Spain has now become the main destination for those trying to get to Europe from Africa.
More than 23,700 people have arrived in Spain by sea so far this year with 307 dying in the attempt, according to the International Organization for Migration -- more than during all of last year.
The country's new Socialist government has also allowed the docking of three NGO rescue ships since June after Italy and Malta refused access.
In June, the French NGO Aquarius ship, which had picked up 630 stranded migrants off Libya, was allowed to dock in Spain's eastern port of Valencia.
Then on July 4, Proactiva Open Arms' ship docked in Barcelona with 60 migrants.
This time round though, the Spanish government has said the 87 migrants who have arrived in San Roque will be treated in the same way as the hundreds who arrive every week on Spanish shores.
When the Aquarius docked, Madrid had given each migrant a 45-day residency permit for humanitarian reasons.
Those brought back to Barcelona had also been given special treatment.