Looking around the new Maracana stadium, chief engineer Icaro Moreno Jr imagines the seats full, the floodlights on, Brazil in possession of the ball.

"There will be an amazing vibration," he says. "It's the temple of football, known all over the world. Everyone will be hoping that we beat England 10-0. The stadium will shake."

In the dressing room, a worker's hard hat and tool belt has been left on the bench where, a little more than a year from now, one of the teams contesting the World Cup final will get ready. We walk back out through the tunnel, into the roar of the construction site, where 6800 men working round the clock in three shifts are hurrying to finish the job on time. Brazil host England in the stadium's inaugural match on June 2, the eve of the Confederations Cup – a dry run for the main event in 2014.

With the Olympic Games due in 2016, Rio de Janeiro is rushing to reinvent itself. Until a few years ago, it seemed as if the decline that began when the capital moved to Brasilia in 1960 would never be reversed. But with the discovery of huge oil reserves just off the coast, investment began to flow back in. A police operation to "pacify" the slums has cut the murder rate in half. Huge building projects dot the city.

Rio is a work in progress, as its stadiums testify. The Maracana is finished and just needs a World Cup win to complete the script. "Us engineers, us builders, we're sending a message: we're working as hard as we can, the best we can, and all you have to do is get to the final, so we can all share in the happiness," Moreno says. But across town at the Joao Havelange stadium, there has been no football for weeks.

The arena was completed six years ago, late and over budget at £122 million. When a structural defect was found that caused the arches to wobble dangerously in the wind, the Mayor of Rio, Eduardo Paes, closed it indefinitely. Local newspapers printed pictures of rusty holes in the steel frame and the blame game began, as the various parties responsible for its construction traded allegations of fraud and incompetence.

A few weeks later, by coincidence, Havelange, the former head of Fifa, resigned from his position when an ethics committee report accused him of taking bribes. Brazil's reputation for inefficiency and corruption will not be easy to shake.

International visitors arrive at Galeao, recently described as "the world's worst airport" in O Globo, Rio's main newspaper, after the air conditioning broke down and management decided to repair the escalators during the carnival. The government has set out a £2.1 billion proposal to modernise the airport and increase capacity to 70 million passengers per year, but the work will not be completed in time for the Olympics.

There is no rail link to Galeao, but on the way downtown by taxi you get a great view of the half-finished Transcarioca highway that will connect to the western suburb of Barra de Tijuca, where the main Olympic facilities will be based. The metro system is being extended there too, and new express bus lanes have been introduced in the hope of alleviating traffic jams.

Locals often describe the "Cidade Maravilhosa" – the Marvellous City – as the world's best place to live, only to complain bitterly about how dysfunctional it is. Many are sceptical that its public services will be able to cope with the coming mega-events. "Imagine na Copa" has become a common lament: if you think things are chaotic now, imagine what will happen during the World Cup.

Downtown, on the edge of the business district, the old port is being redeveloped, at a cost of around £2.6bn. The area has been decaying for decades, since the docks moved elsewhere. Alberto Silva, president of the urban development corporation in charge of the project, describes it as an attempt to "break the cycle of isolation and degradation," and as a challenge to the prevailing notion that the only way for Rio to expand is outwards.

The Olympic press centre and the village for referees and officials will be located here, but Silva plays down the significance of this. "We are preparing the city for sustainable growth lasting a long time. We're not talking about something that will take three, four or five years," he says. "Porto Maravilha will be a reference for a new standard of urbanisation in Rio. I have no doubt that it will continue beyond the Olympics."

The port area's population is projected to quadruple over the next decade, from 28,000 to more than 100,000. The plan calls for a light-rail service with 42 stations, a network of bike lanes, wider pavements, underground power lines and a modern drainage system, to replace century-old sewers. A motorway overpass will be knocked down and replaced by a tunnel, creating a pedestrian area on the waterfront. Rio Art Museum recently opened its doors and The Museum of Tomorrow will be next, on a pier jutting out into Guanabara Bay.

To finance the project, Rio sold development rights to public land. Private investors include a consortium led by Donald Trump, which plans to build five gleaming high-rise boxes. Houses that were worth £20,000 three years ago now sell for £130,000 or more. Critics argue that one of the few remaining working-class neighbourhoods in the centre of Rio is being destroyed, as gentrification forces people out.

This dispute is most heated in Morro da Providencia, the city's oldest favela, which spread across the hills a century ago, as workers sought space close to downtown. "The houses were made of wood and every time there was a storm they were washed away," says Roberto Marinho, a prominent member of the residents' association. "Why didn't the government do anything about this? Because the city still had space to grow. But now, there is nowhere for Rio to grow: the only space left is the favelas."

In November 2010, without prior consultation, officials from an urban renewal programme called Morar Carioca arrived in the favela and began marking houses for destruction, so streets could be widened and construction of a cable car to the top of the hill could begin. Families were offered new flats or rent subsidies in return for losing their homes. Those that took the money found it wasn't enough to stay nearby. The apartments were further away than promised and shoddily constructed.

Alessandra, a housewife with two children, is refusing to leave, even now that the houses either side of hers have been reduced to rubble. "From the hill you can see that they're investing, but not for the people. It's not for us," she says. "If you're poor, or black, or from the favela, no-one asks what you think. We just want a small house, to live with dignity."

Across Rio, urbanisation projects are altering the fabric of the favela. Miguel Lago, who founded the pressure group Meu Rio to advocate for greater transparency in city government, believes the improvements are aimed at tourists, not residents. "There is an open sewer running through the favela," he says. "Urbanisation means constructing a cable car and painting the houses, but we don't see public services entering [the picture] effectively."

Apartments in the city's two most desirable neighbourhoods, Leblon and Ipanema, are more expensive than in the poshest London post codes. And in Vidigal, the favela that begins where Leblon ends, foreigners have been moving in.

Dimitri Szerman, a professor at Rio's Catholic University, is one of the few upper-middle-class Brazilians living there. "All of my friends said, 'you are completely out of your mind. It's so dangerous. Are you sure?' But it's super safe." His apartment, in a tower block that was swallowed up by the favela in the 1980s, has a stunning view of Ipanema beach – and running water, unlike some of his neighbours.

To reach the top of Vidigal you climb the stairs or jump on the back of a moto-taxi able to navigate the alleys. The young men with machine guns are gone – or rather, they wear police uniforms these days – but the drugs trade is as brisk as ever.

New businesses hint at the change under way – a video production company, a "hipster cafe" and backpacker hostels – but otherwise, Vidigal is much like any other favela: a dirty, noisy, informal space at the edge of the formal city. The question is how long this can last, when two-room apartments at the foot of the hill rent for £800 a month – almost four times the minimum wage in Brazil.

"Four years' time is the decisive moment: after the Olympics. There is a huge uncertainty there," Szerman says.

But at the moment, with oil offshore, two enormous sporting events on the horizon and violence apparently manageable, Rio is bursting at the seams.