Wrexham 1 Brentford 2
The Bees started badly, gifting Wrexham an early goal when the luckless Ed Hutchinson tried to clear a corner and sliced the ball past his own keeper.
The Dragons should have built on their gift lead but wayward finishing cost them three points and also sealed their fate.
Carlos Edwards tormented the Bees with his lightening runs on the wing and nearly scored with a shot that Stuart Nelson turned round a post.
The Bees keeper followed up with fine saves from Chris Llewellyn, Dennis Lawrence, Andy Holt and Matt Crowell.
He should have been beaten when top scorer Juan Ugarte was clean through but he was off his line in a flash to save at the striker's feet.
Brentford were a different side after the break and turned up the pressure, spurred by the manager's half-time pep talk.
Deon Burton thumped a ten-yard shot against the Wrexham crossbar - it was a sign of what was to come.
Isaiah Rankin equalised with a firm header after 68 minutes from Darren Pratley's corner, which on its own was enough to seal Wrexham's fate as they needed to win their last two matches to have any chance of avoiding the drop.
Rankin missed a good opening minutes later but there was no stopping the Bees as they went all out for a winner.
It came from substitute Scott Fitzgerald who netted a dipping volley just on the final whistle.