A strong election night for allies of President Jair Bolsonaro have given his party the most seats in both chambers of Congress, highlighting the enduring strength of his conservative movement even if he falls short of re-election.
His right-wing Liberal Party (PL), won 99 seats in the 513-member lower house, up from 77, and right-leaning parties allied with Bolsonaro now control half the chamber, reports Reuters.
The bigger surprise in Sunday's voting was in the Senate where Bolsonaro's party won 13 of the 27 seats up for grabs, with two more possible in second-round runoffs, a party spokesman said.
"Against all odds and everyone, we won 2 million more votes this year than in 2018," Bolsonaro posted on social media in Monday's early hours. "We also elected the largest benches in the lower house and the Senate, which was our main priority."
Bolsonaro helped elect allies to the Senate who had trailed in opinion polls, such as former ministers Damares Alves and Paulo Pontes. Alves, an evangelical ally, defeated the Senate candidate from Bolsonaro's own party.
The strong right-wing showing in legislative and gubernatorial races, especially in more affluent southeast Brazil, made Bolsonaro the election's big winner. He also denied his leftist presidential rival Luis Inacio Lula da Silva outright victory and consolidated a political base that can help him govern if he wins the Oct 30 run-off.
While most political analysts still see former president Lula winning, his victory is no longer a slam dunk.
Lula's Workers Party won 10 more seats in the lower house of Congress, where it remains the second-largest party with 68 representatives. But if elected, Lula will face a harder time getting legislation through a more conservative Congress.
Bolsonaro's allies also made advances in state politics, including races for governor.
His former Infrastructure Minister Tarcisio Freitas, who took part in motorcycle rallies with Bolsonaro, won the most votes for governor of Sao Paulo, Brazil's largest state, and will face Lula ally Fernando Haddad in an Oct 30 runoff.
Bolsonaro boasted of helping to get eight governors elected outright, with hopes of electing eight more in the second round.
"This is the greatest victory for patriots in the history of Brazil: 60% of the Brazilian territory will be governed by those who defend our values and fight for a freer nation," he tweeted.
Lula put an optimistic spin on the result, saying he was looking forward to another month on the campaign trail and the chance to debate Bolsonaro head-to-head.