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.
Also Read
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.
Read our full coverage on the 2016 Rio Olympics
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.
You’ve reached your limit of {{free_limit}} free articles this month.
Subscribe now for unlimited access.
Already subscribed? Log in
Subscribe to read the full story →
Smart Quarterly
₹900
3 Months
₹300/Month
Smart Essential
₹2,700
1 Year
₹225/Month
Super Saver
₹3,900
2 Years
₹162/Month
Renews automatically, cancel anytime
Here’s what’s included in our digital subscription plans
Exclusive premium stories online
Over 30 premium stories daily, handpicked by our editors


Complimentary Access to The New York Times
News, Games, Cooking, Audio, Wirecutter & The Athletic
Business Standard Epaper
Digital replica of our daily newspaper — with options to read, save, and share


Curated Newsletters
Insights on markets, finance, politics, tech, and more delivered to your inbox
Market Analysis & Investment Insights
In-depth market analysis & insights with access to The Smart Investor


Archives
Repository of articles and publications dating back to 1997
Ad-free Reading
Uninterrupted reading experience with no advertisements


Seamless Access Across All Devices
Access Business Standard across devices — mobile, tablet, or PC, via web or app
)