RIO DE JANEIRO — The first half of the Confederations Cup has confounded most expectations.

Brazil's players have emerged from a slump and rediscovered their spark a year before the World Cup.

And rather than the anticipated Samba carnival atmosphere in this soccer-mad country, the streets around stadiums have been in security lockdown. A populace without a recent appetite for mass demonstrations has turned out in hundreds of thousands to rage against the government.

Capitalizing on the global media spotlight, Brazilians have protested against corruption and rising costs at a time when billions of dollars are being pumped into projects for the 2014 World Cup and 2016 Olympics.

Preparations for FIFA's showpiece tournament were thought to be well behind schedule, but half the 12 venues being used at next year's World Cup have so far hosted 12 Confederations Cup games with none of the significant organizational or structural problems anticipated.

It also helps the national mood that Brazil's soccer team is defying fears it wouldn't be ready.

Luiz Felipe Scolari, rehired this year in a bid to replicate his 2002 World Cup triumph with Brazil, faced a restive fan base as the five-time world champions stuttered through six games with just one win and plummeted to No. 22 in FIFA's rankings.

It was a slump that started with a loss to England in February and now seems to have ended with a draw at home to the same opponents.

Since then, Brazil has won four consecutive games, including all three at the Confederations Cup, to march into the semifinals as Group A winners and provide a counterpoint to the strife on the streets.

And that's largely due to the goal-scoring prowess of Neymar.

His future now settled — a $75 million move from Santos to Barcelona was sealed before the tournament — Neymar is finally flourishing as the focal point of Brazil's attack. Slick goal-scoring touches are showing he has the talent to match the bravado and hype.

With three goals in the Group A games against Italy, Japan and Mexico, it seems a long time since Neymar was jeered by his own fans after a poor performance in Brazil's 2-2 draw with Chile in April.

Now the 21-year-old Neymar is comfortably settling into the role of national icon, with the swagger and striking that can help deliver Brazil's sixth World Cup next year, while winning over the public by expressing solidarity with the protesters.

Standing in the way of Brazil reaching Sunday's final at the Maracana Stadium is Uruguay. The semifinal on Wednesday pits Brazil's forward line of Fred-Neymar-Hulk against the trio of Edinson Cavani-Luis Suarez-Diego Forlan.

Suarez was the only player to manage to break through Spain's defense in Group B as Uruguay finished runners-ups to the world and European champions.

Spain is the top-scoring team at the Confederations Cup, although 10 of its 15 goals have come against a hapless Tahiti squad.

But facing Tahiti gave coach Vicente del Bosque a chance to distribute minutes, giving out-of-favor striker Fernando Torres a chance to play a competitive match for his country the first time in eight months.

A morale-boosting four-goal salvo against Tahiti was followed by Torres making an instant scoring impact after replacing Roberto Soldado in the 3-0 victory over Nigeria in the Group B finale on Sunday. Spain's luxury of attacking options was underscored by left back Jordi Alba chipping in with the other two goals.

Just the preparation Spain needed for the semifinal Thursday against Italy, a rematch of the European Championship final from a year ago.

Few would bet against another Spanish success. Even another 4-0 rout, given Italy's defensive deficiencies in Brazil. Italy scraped into the last four with its back four easily breached, the slender victories secured over Mexico and Japan before the 4-2 loss to Brazil.

And now Italy will play with a weakened strike force.

With Mario Balotelli out of Thursday's semifinal with a strained left thigh, coach Cesare Prandelli is shorn of the explosive attacking figure who might have been able to unnerve Spain.

Having been entrusted with leading the strike force — scoring twice and setting up another — Balotelli will now have to watch from the sidelines as Stephan El Shaarawy, Sebastian Giovinco, Alessio Cerci and Alessandro Diamanti are considered.

Prandelli will be hoping Andrea Pirlo recovers from a muscle injury in time while defender Ignazio Abate has already been sent home after dislocating his right shoulder.

On top of that, the Italians appear to be the team most unsettled by the conditions in Brazil. The disorder that has gripped the streets has left the team cooped up in hotel rooms. And the heat and humidity during the Brazilian winter has also been an issue.

No complaints, however, coming from the Brazilian team. And should it lift the trophy Sunday it could help provide some unity in a nation where the pressure on the team is now eclipsed only by the demands from the protesters.