The basement of Bristol's Central Library is to be turned into a free school.
The lower two floors of the building will be leased to the new Cathedral Primary School providing up to 420 places.
Approval was given at a meeting of Bristol City Council's Cabinet.
The lease will be for 125 years with rent of £60,000 a year and a premium of £600,000 paid to the council and ring-fenced for the city's libraries.
This would be paid by the Education Funding Agency which approved the new free school.
'Like a dungeon'
The agency will also spend £3.8m to convert the basement.
The area currently has restricted natural light to the front, but sloping ground means the two levels are the equivalent to ground and first floors on the side facing College Green.
Conservative councillor Richard Eddy, who organised an e-petition against the move, said the basement was "like a dungeon" and "major changes" would be needed for children to be schooled there.
The two floors are not currently directly used by the public, but are home to about 270,000 reference and lending store books.
The majority of this store would be re-located at an off-site warehouse.
The move would include full digital cataloguing of all books and storage on rolling shelving at the cost of about £500,000.
Mr Eddy, whose petition has collected more than 800 signatures, said he was concerned the move would mark the start of the entire library being relocated and, rather than visitors waiting 30 minutes for a reference book, they would need to wait three days while it was retrieved from a warehouse.
But the school's executive principal, Neil Blundell, said: "At a time when Bristol must make a massive £90m in savings, our proposal does not cost the city a penny: in fact, it brings in capital investment direct from central government and even releases funds to invest in the future of the libraries service."
He said the places provided would meet about 10% of Bristol's primary school places shortfall.
Cathedral Primary School opened in temporary premises in September.