The first portion of the 546km Riyadh-Wadi Al Dawasir test, the longest not only of this edition but also in the Dakar for five years, was led by another Honda rider, Kevin Benavides, whose chances of overall victory were wrecked by engine woes during Friday's stage.
But, ahead of the 321km mark, Benavides dropped seven minutes, slipping down the order and gifting the advantage to teammate Barreda.
The Spanish rider held on for the remaining distance to chalk up a first win on this year's Dakar and the 24th of his career by 2m54s over KTM rider Matthias Walkner.
Luciano Benavides made it two works KTM riders in the top three, 3m25s behind Barreda, while overall leader Brabec was fourth, just a further four seconds back.
It means the American continues to enjoy an advantage in the general classification of 24m48s over Husqvarna rider Pablo Quintanilla, who dropped more than seven minutes to Barreda on Sunday as he struggles with a bout of tendinitis on his left hand.
Toby Price, who had been third overall at the rest day, lost over an hour and 20 minutes as of the 321km mark and plummeted to 11th in the overall rankings as a result.
That promotes Honda's Jose Ignacio Cornejo to third ahead of Barreda, who trails stablemate Brabec by a little under half an hour with five stages to go.
Price's woes mean that Walkner is the top KTM rider overall in fifth, 33 minutes adrift, while Luciano Benavides is the only other rider with an hour of the lead.
UPDATE: After the stage, it emerged that the time Kevin Benavides lost in the middle of the stage was as a result of attending to the stricken Goncalves.
As a result, the Argentine is set to be awarded the time back, which could be enough to give him - and not Barreda - the stage win.
Price and fellow KTM rider Stefan Svitko also lost time trying to help Goncalves, which is likely to result in Price moving back up the order. Final results have yet to be confirmed.
Vitse wins again in quads
Simon Vitse picked up his second stage win on the trot in the quads class, eclipsing Giovanni Enrico by a scant 11 seconds after a late surge.
Enrico, riding under the Dakar Experience rules after being forced to retire from the event on Friday, topped the rankings at all bar two checkpoints throughout the monster test, only to lose 1m21s to Vitse in the final 63km of the stage.
Ignacio Casale was third-fastest, only 1m31s behind Vitse, and retains a comfortable advantage of 36m43s over the French rider in the general classification.
Rafal Sonik is third, albeit 1h23m down, with Manuel Andujar moving up to fourth overall as a result of Alexandre Giroud suffering an engine failure.
Standings after Stage 7 (Bikes, top 10):
Jose Ignacio Cornejo
|9||Adrien Metge||Sherco TVS||1h39m36s|