Rio de Janeiro, Aug 11: Brazil escaped a humiliating early exit from the Olympics despite another scoreless performance from Neymar as wonder kid Gabriel Barbosa struck twice in a 4-0 win over Denmark here.
Olympics special site; Photo gallery
The in demand Barbosa, nicknamed 'Gabigol' for his prolific exploits for Santos, broke Brazil's 200-minute goal drought after goalless draws with Iraq and South Africa to get their quest for a first football gold medal back on track.
Manchester City's new recruit Gabriel Jesus then volleyed home a second before Luan and Barbosa's second rounded off a comforting night for a relieved home nation.
Victory was also enough to guarantee top spot in Group A to set up a quarter-final meeting with Colombia on Saturday.
Denmark also progressed to the last eight where they will face Nigeria as the other game in the group between Iraq and South Africa finished 1-1.
Brazil are now unbeaten in 14 games in Salvador and they received a warmer welcome on and off the pitch in the north-east than for their previous two games in Brasilia with temperatures nearing 30 degrees warming an enthusiastic crowd.
Neymar had gone from Brazil's golden boy to whipping boy in the past week with the national team's women's captain Marta usurping him as the hosts' darling after a series of sensational displays.
However, he shone in a supporting role for Brazil's other attacking starlets to get the goals. A sigh of relief was felt across the country when 'Gabigol' bundled home Douglas Santos's low cross with his shin on 26 minutes.
Jesus had admitted to having "sleepless nights" after missing golden chances in both opening games. However, he made amends with a brilliant volleyed finish at the back post from Luan's cross to dispel any lingering Brazilian doubts.
Neymar was at the heart of the third five minutes after the break when his through ball caught the Denmark defence square and Santos crossed once more for Luan to slot home.
And Barbosa rounded off the scoring 10 minutes from time when his deflected effort left Danish 'keeper Jeppe Hojbjerg helpless.