Library campaigners, among whom I count myself, need not be too full of doom and gloom. While cuts and closures are affecting library services, it is also true that the past decade has seen a reinvention of the public library in the UK and across the world. Next week, the new Library of Birmingham opens at a cost of £186m, becoming the largest public library in Europe. It expects to attract 10,000 visitors a day. Glasgow's magnificent Mitchell library, which previously held the record as the largest public reference library in Europe, was recently refurbished to tremendous effect. Since 2000, new library buildings have opened in Bournemouth, Brighton, Canada Water, Cardiff, Clapham, Dagenham, Glasgow, Liverpool, Newcastle, Norwich, Peckham, Whitechapel and elsewhere, all reporting record numbers of users.

Why are libraries back on the urban agenda? Increasing numbers of people are now engaged in some form of further or higher education, and need study space and access to the internet, which many cannot find at home. The rise of single-person households in city centres – in some European capitals now approaching 50% of households – means that libraries increasingly act as a meeting place or home from home, as they do for migrants, refugees and even tourists. The idea of the library as "the living room in the city" was first promulgated in 1970s Scandinavian library design, as architects responded to users' wishes to stay longer, have a coffee, and enjoy storytelling sessions, lunchtime concerts or attend book-reading groups. Visiting Örnsköldsvik library in northern Sweden, close to the Arctic Circle, I noticed users brought their slippers and a packed lunch. This new understanding of the library space is formalised, for example, in Rem Koolhaas's Seattle library, where three of the five floors are designated as The Reading Room, The Living Room and The Mixing Chamber.

The revived global enthusiasm for libraries – of which Seattle is perhaps the most ambitious – originated in north America in the 1990s. Having overseen the costly failure of iconic museum and gallery projects – ostensibly built to put cities on the map – politicians realised they got more bang for their buck if they spent the money on a state-of-the-art library. When the Nashville library opened in 2001, inscribed above the door was the maxim: "A city with a great library is a great city." Historian Shannon Mattern has recently devoted a whole book to depicting the rise to prominence of the new downtown library in American civic life.

In Europe, there has been a similar disenchantment with the "Bilbao Effect", named after the singular success of Frank Gehry's design for a museum and art gallery in that city. For a while, many planners believed that only iconic museum buildings designed by star architects could rescue failing cities from oblivion. Deyan Sudjic's acerbic book The Edifice Complex itemises the overblown rhetoric and spiralling costs of many of these wannabe projects around the world, along with their early demise. In Britain, the grandest of them, the Millennium Dome, soaked up nearly a billion pounds of public money – intended to provide an enduring showcase for science and the arts – only to be hurriedly leased out as a venue for corporate events and global pop. The Olympic Park and its facilities may well go the same way.

It is almost impossible for public libraries to fail in this way. They are free to use, and, after a century and a half of experience, have woven themselves into the fabric of everyday life. In some British towns, nearly half the population own a library card, even if it is only used infrequently. We make jokes about diffident library staff hiding behind the stacks or in the stock room, yet people trust them as they trust few others. Librarians may agonise over matters of taste, propriety and the suitability of the materials they stock, compared with the moral neutrality of the commercial marketplace, yet we admire them for doing so. Most importantly, libraries are seen as belonging to everybody by right, compared with publicly funded theatres, art galleries, museums or concert halls.

The adaptability of the library to meet changing demands is reflected in contemporary design. The library counter has largely gone. Self-service machines free up staff to spend more time with library users, organising storytelling sessions, book-signings and reading circles (there were more than 100,000 members of library reading groups in England and Wales at the last count). Foyers tend to be open plan with armchairs for browsing, and lending and reference services are now intermixed. Not everybody uses the internet to research an A-level essay on Love's Labour's Lost or catch up with events in Syria. Others will be looking for a job or checking out dating agencies, or may have fallen asleep in a bright-pink replica Arne Jacobsen egg chair over a copy of the Racing Post. So what? All sorts of people find a sense of sanctuary in libraries that they find nowhere else in the city. The public library is the supreme symbol of the "big society".

"The three most important documents a free society gives," American novelist EL Doctorow once wrote, "are a birth certificate, a passport, and a library card." Young people are much in evidence in the newer libraries – an unexpected and welcome cultural shift – doubtless attracted by a brighter, airy architecture that reflects the lively design culture they take for granted in their lives. They also seem at ease in a place that treats them with a respect not accorded them elsewhere in public life.

Not everybody approves of the new library ethos, summarised as being "from collection to connection". Some remain aghast at the encroachment of the technological revolution, which is not only reshaping the world but reconfiguring the public library along with it. Whether 19th-century library pioneers would recognise these 21st-century buildings may be questionable – but once inside they would feel at home. Even today, the world inside the library has changed less than the world outside.

• Ken Worpole's Contemporary Library Architecture is published by Routledge.