“THE best public hospital in São Paulo,” boast signs in the state's Instituto do Câncer (ICESP). Last year the state government asked more than 200,000 public-hospital patients to rate their treatment, and the 500-bed institute, which opened in 2008, came top. Equipped with the latest technology, it offers all the most up-to-date treatments—as well as lessons in healthy cooking and stress-relieving origami. Patients who are recovering get intensive physiotherapy. For those who never will, there is a hospice in the countryside.

Looking around ICESP, all seems well with Brazil's Unified Health System (SUS). Created in 1989 from the merger of two state systems, one for those in formal work and the other for everyone else, it is exceptional in Latin America, which by and large continues with the two-tier public system Brazil abandoned. The 1988 constitution declared health care to be the right of the citizen and its provision the duty of the state. ICESP enshrines that promise: according to Paulo Hoff, its clinical director, its patients, both poor and better-off, get care which compares well to that of his private patients at the nearby Sírio-Libanês Hospital.

But there is a gap between the aspirations of SUS and the reality. Funding is an inadequate hotch-potch, part-state, part-federal, and varies wildly from place to place. More than two-thirds of ICESP's budget of 350m reais ($225m) comes from São Paulo's state government. Few other states are rich enough to provide such generous top-ups. SUS's family doctors reach only one Brazilian in two. Another quarter have private-health insurance; the remainder, mostly poor people, live in remote rural areas or violent urban slums where the service is lacking. They must either pay out of pocket or take their chances in crowded hospital emergency rooms.

Despite the constitutional injunction, around 60% of all spending on health care in Brazil is private—a higher share than in most other Latin American countries, and higher even than in the United States. Private provision mainly covers a rich and young minority. Spending on SUS accounts for just 3.1% of GDP.

Brazilians are starting to worry about this. Pollsters say that since 2007 the problems of health care have displaced the economy, to rise to the top of voters' concerns. José Serra, the runner-up in last year's presidential election, tried to capitalise on this by emphasising his record as health minister from 1998 to 2002. It did not lead to his defeating Dilma Rousseff, who was supported by the wildly popular incumbent, Luiz Inácio Lula da Silva. But it was a sign that Brazilian politicians are waking up to voters' concerns over poor public services.

President Rousseff is trying to respond. She has added drugs to treat diabetes and heart disease to the list of those paid for by SUS. The widely admired Family Health Programme is steadily being extended to new regions. Her approach to cutting extreme poverty combines the conditional cash transfers that, under Lula, reached a quarter of the population with public-health measures such as better sanitation and free exercise machines in favelas.

Bigger improvements, though, require changes to the way SUS's budget is spent. A recent survey of Brazilian health care published in the Lancet, an international journal, argued that SUS gets poor value for the money it spends on drugs, because too much goes on complying with court orders granted to patients who use the constitution's lofty promises to demand expensive treatments not automatically covered by the system. And too much of the budget still goes to hospitals rather than the Family Health Programme, says Michele Gragnolati of the World Bank. Turning more public hospitals over to non-profit bodies, with freedom to hire and fire and link pay to performance, would increase the system's efficiency, he adds.

Others think that really big improvements would require a new relationship with private providers, which far from dying off—as the authors of the constitution imagined—have flourished since the creation of SUS. Insurers have started to market low-cost plans to Brazilians who have recently left poverty; companies such as Diagnósticos da América, which has more than 300 laboratories in 13 states, offer cheap X-rays and blood tests to those whose budgets cannot stretch to the full private package.

“We were very idealistic in 1988,” says Bento Cardoso of Insper, a business school in São Paulo that offers an MBA in health-care administration. The state should pay for high-tech and emergency care for all, but should restrict primary provision to those who cannot afford health insurance, he thinks. That would make explicit what is already happening by stealth.