Rio de Janeiro: Brazilian fans hugged, teared up and hung their heads Friday after their national team was knocked out of the World Cup by Belgium.

The stinging 2-1 defeat came just as the Selecao, as the team is known, had begun to gather steam, and Brazilians dared to hope that a victory could wash away years of recession, political uncertainty — and a humiliating defeat to Germany four years ago.

“The World Cup allowed us a moment to forget our problems,” said Cristiano Conceicao, who works in a furniture store and watched the game with thousands of others in a traditional gathering place for football fans, a several-block stretch of Rio de Janeiro known as the Alzirao. “Break’s over now.”

Footballl is more than just a game in Brazil, where it central to national identity. But the World Cup in Russia has been an especially welcome distraction. Brazil is just emerging from a deep, prolonged recession. It has lost confidence in its leaders as a corruption investigation revealed endemic graft among its political and corporate elite that shocked even the most cynical. Crime is rising in many cities, many Brazilians feel the last president was improperly removed from office, and the population is heading into national elections more divided than it has been in recent memory.

The Brazilian team got off to a slow start this year, and its star Neymar particularly came in for criticism for not meeting expectations. But as strong teams were unexpectedly eliminated — among them Germany, Spain and Argentina — confidence began to rise in Brazil that the Selecao might actually be able to win the title and purge the memories of its 7-1 semi-final loss to Germany at the last World Cup. There was a feeling that finally the tide was turning — not just on the field, but also in the country’s overall fortunes.

In the hours before Friday’s game, local media reported that Sao Paulo’s roads experienced record-breaking congestion as Brazilians left work early and rushed to get into position to watch. Bars and squares steadily filled up and people from airports to offices looked for the nearest TV to huddle around.

In Rio’s Maua Square, groups started arriving three hours before kick-off. They wore super hero outfits and draped themselves in Brazil’s flag. The atmosphere was festive and light, with the weekend and a hoped-for win on the horizon. When Belgium scored twice in the first half, the atmosphere grew tense. By halftime, with Brazil down 2-0, the crowd was on edge, though some still cried out, “I believe!”

The mood lifted when Brazil scored deep in the second half. The crowd erupted in jumping and cheers — they sprayed beer and honked air horns.

When the final whistle blew, many hugged and cried.

A reporter on the Globo network teared up as she described watching the game with family members of the players. She talked about how they never lost hope and even prayed at halftime. When she threw it back to the anchor, he then faltered.

But, in Maua Square, many were determined to keep the party going, dancing and joking as a way to relieve the pain of defeat.

On social media and messaging services, that trademark gallows humour was evident. One image lamented Brazil’s inability to get over the loss to Germany four years ago. Over a picture of the German flag was written: “The enemy didn’t go away.” Below was a picture of the Belgian flag — which, like the German one, has a black, yellow and red stripe — and the words: “It disguised itself.”

“We always knew that the World Cup would not solve our problems,” said Isabela Santos, a law student who watched the game in the Alzirao. “But how sweet it would have been to win it!”