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 refugees in two separate missions off the Libyan coast on Friday.
The Aquarius, which hit the headlines in June after being stranded with 630 refugees 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.
The photo, released from French non-governmental organizations Medecins Sans Frontieres (MSF), known as Doctors Without Borders, and SOS Mediterranee on June 17, 2018, shows a refugee while disembarking from the rescue vessel Aquarius upon arrival in Valencia, Spain. (Photo by AFP)
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.
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 refugees 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 refugees.
France's President Emmanuel Macron was criticized by leftwing opponents in June for failing to offer the refugees safe haven, despite it being the next closest location to the boat after Italy and Malta.
France ended up taking in 78 of the refugees after they landed in Spain.