It was far from Brazil's best, but the samba boys booked their place in the semifinals of the men's Olympic soccer tournament by claiming a 3-2 win over 10-man Honduras on Saturday.
Honduras took an early through Mario Roberto Martinez, but Leandro Damiao pulled Brazil level after Wilmer Crisanto was sent off in the 33rd minute.
Despite playing down a man, Roger Espinoza handed Honduras another lead against the odds only for Neymar to cancel it out moments later.
It was Damiao who provided Brazil the game-winner in the 60th minute, scoring his fourth goal of the tournament and second of the match.
Brazil, widely viewed as the favorite to bring home the gold, will head to Manchester where it will face South Korea at Old Trafford on Tuesday after the Asian nation ousted Great Britain on penalties.
Martinez gave Honduras a shock lead in the 12th minute when he hammered a bouncing ball in the box into the far upper corner.
Brazil was handed a lifeline before the close of the first half as Crisanto was shown two yellow cards in the span of a minute, reducing Honduras to 10 men.
Damiao helped the Brazilians take advantage of the extra man as he capitalized on some slack Honduran defending to stuff home a loose ball from close range in the 38th minute.
Honduras pulled off another shock though, as it took the lead once more just three minutes after the restart. Espinoza curled a left-footed shot to the back post that trickled past goalkeeper Gabriel Vasconcelos Ferreira and into the back of the net.
It didn't take Brazil long to get on level terms as it was awarded a penalty kick that Neymar promptly converted in the 50th minute.
The Brazilians ultimately grabbed the lead when Damiao completed his brace. He collected a pass from Neymar and turned on a dime before firing a shot that needed a deflection to get past Jose Mendoza.
Honduras continued to push in search of an equalizer, but playing down a man certainly put the nation at a disadvantage as it failed to pull off one more surprise result.