The captain of the Alex decided to leave international waters for Lampedusa's port because of the "intolerable hygienic conditions".
Matteo Salvini, Italy's interior minister, had vowed to block them.
Last year, he closed Italian ports to rescue ships and Italy has introduced fines for anyone sailing into its waters without permission.
The migrants on board the Alex, run by the Mediterranea charity, have not yet disembarked in Lampedusa.
Images from the port showed a heavy police presence waiting on the pier next to the ship.
Mediterranea tweeted that its exhausted crew were living through a "surreal situation", and prolonging the wait was "an unnecessary cruelty".
Meanwhile, another NGO ship, the Alan Kurdi - operated by German charity Sea-Eye - is afloat in international waters just outside Lampedusa, carrying another 65 people.
More about: Italy