Wednesday night was due to be a celebration in Fortaleza. This north-eastern coastal city was the first in Brazil to complete its World Cup stadium in readiness for the 2014 contest. Things didn't quite work out as planned.

"After the first teargas bomb, my brother and I ran with a few others to flee the police," said Julia Lopes, 27, who was among 30,000 local people demonstrating before the Brazilian national side's showcase Confederations Cup match against Mexico. "My husband Pedro ran in the opposite direction. Later I met him – he had a swollen eye.

"Brazil is experiencing something very big and we cannot completely understand it now. During the demonstration we saw many claims, not only concerning the World Cup, but some that were more political. Some were clear and others vague. People were definitely asking: who is the World Cup for?"

The sudden explosion of resentment and frustration in Fortaleza was repeated in cities throughout Brazil last week.

On Friday, thousands again took to the streets to demand new spending priorities in a country whose recent economic boom has made global headlines. Dilma Rousseff, the president, responded by saying that she had an obligation to listen to the voices on the street.

In Fortaleza – the fifth most unequal city in the world, according to the United Nations – the protests were led by the young and middle-class. But the website of Comitê Popular da Copa e das Olimpíadas makes clear its concerns include those of the poorest. The World Cup, say campaigners, has justified "the distancing of the poorest to remote areas on the fringes of Fortaleza, causing segregation and social distinction". You don't have to walk far into the city's desperate suburbs to understand their concern.

Outside a row of breezeblock houses along a dirt road in Bom Jardim, one of the most violent favelas in Fortaleza, social worker Silvana Severo rips open the parcel of flour, beans and other food that she is bringing to a family. "We do that to stop them selling on the food for drugs," she says.

The precaution is routine for the social workers who visit the poorest families living in some of the more than 400 favelas that encircle the fifth largest city in Brazil. But they could not prevent the sale, a few months earlier, of a baby by her mother for 50 reais (£15). The child, rescued from the trafficker, is now toddling around outside the house in just a nappy.

Inside, seven people are crowded into the sparsely furnished living room, where the baby's grandmother, Felicia, says she is no longer smoking crack and plans to find her own house. They are struggling, but their situation is a big improvement on the days when the whole family lived on the streets, including Paulo, 14, who is staying at a shelter for street children run by a charity, the Pequeno Nazareno (PN).

Then the social workers visit the family of Emerson, also 14, who once lived on the streets. His brother was shot dead by gang members last year when he went back to his old favela for a concert. Outside the home of a third boy, Sandro, 13, the team hear cries and inside find a young baby swinging in a hammock, left entirely alone.

In recent years more than 350,000 people have emerged from extreme poverty – classified as living on 70 reais or less a month – in the state of Ceará, but hardship is still widespread. Statistics from Ipece, the Ceará institute of research and economic strategy, show that more than 133,000 people were living in severe poverty in Fortaleza in 2011. A third of inhabitants live without sanitation and there is a dire lack of adequate housing. In Barroso, a community built on a rubbish dump, residents hunt for recyclable goods while their children run past flying plastic bags on string.

The renovation of Fortaleza's stadium for the World Cup cost 519m reais (£149m). The match against Mexico on Wednesday marked the return of the national team to the Arena Castelão after 11 years. According to Lopes, "the committee [Comitê Popular Copa e Olimpíadas] has been debating the legacy of the World Cup for the past three years and investigating how investments are made. What we have seen proves the country is going to be the stage for an enormous abuse by Fifa – with the endorsement of the government."

Speaking from Rio de Janeiro, political scientist Luiz Eduardo Soares, the former minister of public security under President Lula da Silva, says the protests nationwide reflect an unwillingness to go along with a new public image that is at odds with reality. "There are several agendas [of the protests] but citizenship rights, the quality of public services, the choice of priorities and the ruin of politics are the core. People cannot stand any longer the theatre of authorities and political leaders pretending that everything is getting better in our land of promises, in our tropical paradise."

For Forteleza's poor, the World Cup has meant changes, including the forced removal of 5,000 people from communities Lagoa da Zeza and Vila Cazumba to areas without schools, and fears that the tournament will increase exploitation of children in a city that has been trying to shake off its reputation for sex tourism.

"There would be no problem in investing in better stadiums and infrastructure to benefit the mega-events [World Cup and Olympics]. The problem starts when, one suspects, corruption is involved in the way vast amounts of money are spent at the same time as there is no investment in education or hospitals," says Bernardo Rosemeyer, the founder of PN.

Street children are at the sharp end of the social divide in Fortaleza. Around 300 are believed to have fled to the streets because of poverty, abuse or other problems at home. While social welfare programmes such as the Bolsa Família have lifted millions of Brazilians out of poverty, many of the poorest do not qualify for such assistance because their children do not attend school or they have no fixed address. Some fear that, as has happened in the past, homeless children will be bussed out of the city when visitors start to arrive. For now, they exist in a twilight zone of begging, stealing or working on the streets, at risk of falling into prostitution or drugs.

At night on the Beira Mar, a stretch of road that is lined with hotels and bars, PN worker Antonio Carlos is searching for children sleeping rough. His aim is to persuade them to visit PN and then to begin the process of reintegrating them into their families, where possible. Tonight he meets Elena, the woman who sold her baby to the trafficker. She is obviously high on crack cocaine. At just 22, having already spent more than a decade on the streets, for her it may be too late.

Hopefully, however, it won't be for the boys living at the shelter, where PN provides schooling, healthcare, counselling – and the chance to be children and play football. For Paulo, Emerson and Sandro, the World Cup has had a positive impact on their lives in one sense – they are in the boys' team that will represent Brazil in the Street Child World Cup that takes place before the Fifa championships in Rio de Janeiro in March 2014.

The tournament will bring together teams of former street children from up to 20 countries for a 10-day event that aims to raise awareness of street children and give them a platform.

For these three boys and the other members of their team in Fortaleza, as well as the girls' team from the Ibiss project in Rio, playing in the tournament is the chance to be part of a society where they are largely invisible, to demonstrate their talents and forget the hardships of life. No one would dream of begrudging them that chance. But in Forteleza, as elsewhere in Brazil, among broad swaths of the population, the enthusiasm for the real thing is ebbing away as a nation takes a hard look at the priorities of its elite.