Defeat for Chile, who pulled level at 2-2 through goals from striker Humberto Suazo, left Marcelo Bielsa's team waiting to secure a place in the 2010 finals in South Africa.
Brazil had Felipe Melo sent off in the 52nd minute for a bad foul on striker Alexis Sanchez, but Sanchez himself was shown the red card in the 77th for dissent, his second bookable offence.
Brazil, who have won 11 matches in a row and are unbeaten in 17, qualified with three games to spare when they beat Argentina 3-1 away on Saturday.
They were joined by Paraguay, who made it to their fourth successive finals when they beat Diego Maradona's team 1-0 earlier on Wednesday.
Chile, who could have qualified for their first finals since 1998, remain third in the South American group, four points ahead of fourth-placed Ecuador with two games remaining.
The top four go through to South Africa while the fifth-placed team, at present Argentina, get a second chance in a two-leg playoff against the CONCACAF's fourth-placed team.
Nilmar, playing in the absence of the suspended Luis Fabiano and injured Robinho, opened the scoring after half an hour from Daniel Alves's cross.
Julio Baptista, also set up by Alves, added the second in the 40th and Suazo pulled one back with a penalty just before halftime.
"I knew this game was my chance to play, score goals and show my work ... Today we showed that the national team squad is very strong," Nilmar told reporters.
He completed his hat-trick with two goals in less than three minutes midway through the second half, both laid on by right back Maicon, after Suazo's second brought Chile level in the 52nd.
Thank you for reading 5 articles this month* Join now for unlimited access
Enjoy your first month for just £1 / $1 / €1
*Read 5 free articles per month without a subscription
Join now for unlimited access
Try first month for just £1 / $1 / €1
Get daily World Cup 2022 news, updates and other football frolics to your inbox
Thank you for signing up to Four Four Two. You will receive a verification email shortly.
There was a problem. Please refresh the page and try again.