Brazil won its first gold at the Rio Olympics on Monday, and it was a medal that came loaded with symbolism.

The prize was won by Rafaela Silva in the under-57-kilogram class of judo. Ms. Silva was a medal favourite. She is also an unlikely story, on an Olympic team that is disproportionately full of white Brazilians (in a country that is 53-per-cent black or mixed-race) and competitors from the middle and upper classes, whose families can afford to invest in sport.

Ms. Silva is Afro-Brazilian, and from the community that is, at least internationally, synonymous with the violence of Rio de Janeiro. She grew up in Cidade de Deus, or City of God, a favela just eight kilometres from the arena where she won her medal Monday evening.

Story continues below advertisement

Rio Olympics Day 4: What to watch and the latest news

Also from Stephanie Nolen: National women's team could be new heroes for Brazilian soccer

The country rushed to claim her victory. The acting president said she filled Brazilians with joy. We are all Silva! screamed the banner headline of the website of O Globo, the major national news conglomerate.

But Ms. Silva comes from a particular Brazil: Her community was made notorious in the book City of God by Paulo Lins, which became a film by the director Fernando Meirelles (who was lead producer on last week's opening ceremony). The favela is still poor and violent. Ms. Silva, 24, says she took up judo after she was repeatedly caught up in street fights.

A world champion at 15, she went to the 2012 Games in London to compete for Brazil and was one of the country's few medal hopes there. But she was disqualified from competition in an early round after performing a move that had been recently made illegal – a ruling that is still highly controversial, if you ask many Brazilians.

Her loss exposed one of the fault lines that runs always near the surface in Brazil: She left the arena crushed, and returned to her hotel – to open social media and find a torrent of racist abuse. Her fellow citizens, apparently not feeling they were all Ms. Silva at that point, called her "a monkey" and much worse. The reaction in Brazil was so ugly and so racially charged that Ms. Silva has said she almost quit fighting.

On Monday she was interviewed on national television as she left the winning match. She was crying so hard she was almost incomprehensible.

Story continues below advertisement

"I trained a lot: After my defeat, everybody criticized me and told me judo was not a thing for me and that I was a disgrace to my family," she sobbed. "Now I'm an Olympic champion in my hometown. I trained a lot to be here, a lot to get my medal. And the result, thank God, came. Judo is my life. If it wasn't for judo, I don't know where I would be now. I might still be in Cidade de Deus, but thank God I met the sport and I'm here as world champion and Olympic champion."

Brazilian actor Tais Araujo, who is an activist on racial equality, immediately took to social media to congratulate Ms. Silva, saying, "The Brazil I want for my children has your face."

There is a particular poignancy to Ms. Silva's victory at this moment, when Brazil is in the grip of twin economic and political crises that threaten to reverse the significant progress the country has made in the past 12 years on reducing social inequalities.

Ms. Silva's sister, Raquel, also competes on the Brazilian team. The girls' parents enrolled them in an after-school sports program in which they hoped to take dance – but the class was full, and instead they were stuck with judo. Rafaela was diminutive but fearless, and soon moved on to a martial arts school run by Flavio Canto, a judoka who won a bronze medal in Athens in 2004. "I've known Rafaela since she was six years old and we always knew she would manage to get to the Olympics," he said jubilantly after her win.

Cidade de Deus was built in the 1960s for families who were forcibly removed from upscale neighbourhoods near the beach to the south in Rio. Because of its proximity to the Olympic competition venues, it received one of Brazil's "pacification police" forces intended to displace the ruling drug gang, but that experiment in public security has fallen apart in recent months.

Ms. Silva beat Mongolian Sumiya Dorjsuren for the gold. Although Ms. Silva's father, Luiz Silva, had stayed away from the early round, saying he was too nervous to watch, her parents were part of a heaving and screaming hometown crowd for the medal match.

Story continues below advertisement

Like nearly a third of Brazil's Olympic team, Ms. Silva is a member of the armed forces – a sergeant in the navy, she is part of a special program intended to support athletes with training and housing before the Games.