Madrid said it would accept 60 people, while Portugal offered to welcome 30, with the remainder distributed between France, Germany and Luxembourg, government sources in Malta and Spain said.
The boat was initially refused entry by Italy and Malta after rescuing the migrants in two separate missions off the Libyan coast on Friday.
The Aquarius, which hit the headlines in June after being stranded with 630 migrants on board, causing a major diplomatic row, resumed its rescue operations off Libya last week.
Spain's new Socialist government helped resolve the first standoff by allowing the boat to dock in Valencia and was again at the forefront of the solution on Tuesday.
“Spain has coordinated a pioneering agreement with six countries to share the hosting of the people on the Aquarius… Spain will take 60 people,” Prime Minister Pedro Sanchez wrote on Twitter.
Malta confirmed afterwards it would allow the ship to dock to disembark its passengers, many of whom are unaccompanied children from violence-wracked Somalia and repressive Eritrea.
“Malta will be making a concession allowing the vessel to enter its ports, despite having no legal obligation to do so,” said a government statement posted on Twitter.
European attitudes hardening
After elections in March that brought a populist, anti-immigrant government to power in Italy, new far-right Interior Minister Matteo Salvini began turning away rescue ships operated by foreign NGOs.
For years, Italy had pleaded with its EU partners for help with a massive influx of arrivals that has seen 700,000 people land in the country since 2013, most of whom had made the short but treacherous sea crossing from Libya.
On Saturday, Salvini said the Aquarius would “never see an Italian port” again, accusing it of encouraging smugglers and migrants to take to the water in the knowledge that they will be rescued.
The Italian coast guard continues to rescue migrants, however.
Malta's government had initially defended its decision to turn the Aquarius away, saying it was “neither the coordinating nor the competent authority for such a rescue” and had “no legal obligation” to provide a place of safety.
The government of Gibraltar also announced late Monday that the ship would no longer be allowed to operate under its maritime flag; it was registered on the British overseas territory in 2009.
The increasingly hostile stance reflects hardening public opinion in Europe towards migrants following the arrival of hundreds of thousands of people fleeing war or poverty in Africa and the Middle East.
The Aquarius has become a symbol of the unwillingness of many European countries to accept more newcomers, with Italy siding with conservative governments in eastern Europe intent on keeping out migrants.
France's President Emmanuel Macron was criticised by leftwing opponents in June for failing to offer the migrants safe haven, despite it being the next closest location to the boat after Italy and Malta.
France ended up taking in 78 of the migrants after they landed in Spain.
French public opinion was against accepting the Aquarius during the first crisis and the rightwing Republicans party and far-right National Rally both argued on Tuesday against allowing the boat to dock.
A spokesman for the National Rally suggested the ship should head for a port in Tunisia.