The first win in 25 top-flight London derbies was earned by Slavisa Jokanovic's men.
The Bees had fought back from 2-0 down to get back in the game before the Serbian scored his third goal of the campaign.
Bobby Decordova-Reid opened the scoring after 44 seconds, and Joao Palhinha made it 2-0 before the break.
Christian Norgaard may have avoided a red card for a late challenge on Jay Stansfield but he brought the visitors back into the game with a sweetly struck volley from a corner.
The two sides met for the first time in the premier league and Ivan Toney had two goals ruled out.
After their first win of the season, the Cottagers moved up to fourth in the table, while the Bees dropped to fifth.
After cruising past Manchester United in their last game, Brentford came into the derby in a confident mood, but that enthusiasm quickly evaporated as they fell behind early.
Stansfield's shot went off the bar and Decordova-Reid pounced on the loose ball to send the home fans into a frenzy.
The early stages of the game were dominated by the Cottagers and they were in a position to take a two-goal lead.
It could have been worse for the Bees if Norgaard had been punished for his tackle on Stansfield.
The Danes pulled one back after a move off the training ground as he peeled of his marker to hit Bryan Mbeumo's corner.
If Norgaard was fortunate to stay on the field, so was Palhinha, who only received a yellow for a late aerial challenge with Ben Mee, which left the defender on the turf.
After the break, Toney surged clear twice in quick succession and shot into the bottom corner, but was ruled out for a foul, before his third attempt counted.
The hosts managed to wrestle back the initiative, but their one-on-one opportunity after Norgaard's backpass was well-kept out by Raya, before the keeper also palmed away a chance from the Serbian.
The newly-promoted side got their first win of the season when the Cottagers' top scorer rose highest to head into the corner in the last minute.