Brazil's election result was a disappointment for those hoping to see a first-round win for the presidential challenger Luiz Inácio Lula da Silva but there were still some reasons to be cheerful for the country's left.
Not only is Lula favourite to win the 30 October runoff - he need only increase his vote share from 48.4% to 50+1 - but diversity got a boost in a few key parliamentary races.
Two trans candidates were elected to congress for the first time in history, two Indigenous women joined them, and several of the allies who helped get Jair Bolsonaro elected four years ago were given the cold shoulder by voters.
Two of the biggest winners were the transgender candidates Erika Hilton and Duda Salabert. Both won easy election to the chamber of deputies where they promised to fight for LGBT rights.
"We are going to get off the street corners, we are going to get out of jails, we are going to get off crack corners and prostitution and start to think about public policies and legislation," an ecstatic Hilton said. "Our mandate in Brasília will be more organised, more committed and closer to people.
"Maybe we can't celebrate the way we wanted to and deserved to - but we can celebrate changes in congress and we will shed blood so that in the second round we can really celebrate."
Another new contingent in the lower house came with the election of Sônia Guajajara, who was chosen as one of Time magazine's 100 Most Influential People earlier this year, and Célia Xakriabá, both of whom stood under the banner of the progressive PSOL party.
Their election will provide a much-needed voice for Brazil's long-suffering Indigenous communities.
Far-right president Jair Bolsonaro has vowed not to cede an inch to native peoples - a promise he repeated on Sunday night - and illegal invasions by loggers, ranchers, miners and hunters into Indigenous land has increased dramatically under his presidency.
Bolsonaro's deliberate underfunding of Indigenous and environmental agencies has coincided with increased violence in the region. In June, the British journalist Dom Phillips and Indigenous expert Bruno Pereira were killed while on a reporting trip in the remote Javari Valley.
Pereira's wife tweeted on Sunday: "My love, we didn't elected @LulaOficial in the first round but we have @celiaxakriaba and @GuajajaraSonia in Congress. And we are going to win the presidency. We are strong and we are going to honour your struggle."
The two women will find an ally in Marina Silva, the respected former environment minister in Lula's first government. Silva won election in São Paulo state, where Guilherme Boulos, an activist seen as a future leader of the left, was also elected with more votes than any of his rivals.
His PSOL colleague Luiza Erundina, an 87-year-old former mayor of the city, was another veteran who was re-elected in Brazil's most populous state.
In Rio de Janeiro, Henrique Vieira, a charismatic pastor who is one of the few evangelical leaders to challenge the dominance of the right-leaning religious sects, especially in poor areas, was elected to the lower house.
On a local level there were some significant victories, most notably in São Paulo, where the 81-year-old stalwart Eduardo Suplicy - an avuncular figure whose exclusion by the Lula camp led to some unease in the Workers' party - won almost three times as many votes as the next-placed candidate.
In the small mercies department, the left celebrated defeats for Janaina Paschoal, one of the lawyers whose brief led to the impeachment of former Workers' party president Dilma Rousseff; Fabricio Queiroz, the former police officer and close friend of the Bolsonaro family who stands accused of helping the clan enrich themselves; and Douglas Garcia, a state deputy with Bolsonaro's party whose harassment of a well-known female TV journalist hit the headlines last month.