Marcello Trotta scored the winning goal from the penalty spot as Brentford climbed back to the top of Sky Bet League One.
The Bees beat Gillingham 2-1 in front of the Sky TV cameras at a wet and wild Griffin Park.
Jonathan Douglas put Brentford in front in the first half and Trotta doubled the lead from the spot in the second.
Gillingham pulled one back almost immediately after Trotta’s strike and gave The Bees a fright or two.
But they could not find a second goal and Brentford took the points and made it ten home wins in a row.
With heavy rain falling on an already sodden area, the pitch quickly cut up.
Coupled with surface water in places, it made it hard for Brentford to play their quick, incisive football.
Gillingham probably settled slightly quicker and had the territorial advantage in the first quarter.
They did not, however, really test David Button.
Steven Gregory saw a shot blocked inside the first 20 seconds and a Myles Weston effort was also blocked soon after.
A week Cody McDonald effort was saved easily by Button and the Brentford goalkeeper had to stretch only slightly further to keep out a Gregory shot after a long throw was half cleared.
Despite probably being slightly second best, Brentford had the best chance of the first 20 minutes.
Clayton Donaldson escaped on the right and when his cross was half blocked, Alan Judge turned and fired in a shot that Leon Legge blocked.
But for the Gillingham defender, it would have ended in the back of the net.
Brentford started to get to grips with the conditions and the opposition as the game approached the quarter mark.
It took a great save from Stuart Nelson to deny Judge when he curled in a shot from 20 yards towards the top corner after picking up a Trotta lay off.
And moments later, Brentford were ahead.
Brentford moved the ball around in Gillingham territory and created space on the left, Jake Bidwell galloped in to it as Douglas stealthily made his way towards the penalty area.
When the ball came in from Bidwell, Douglas was perfectly placed to volley home from inside the six-yard box.
Button saved a Legge header and then one from McDonald as the visitors tried to hit back while, at the other end, Judge’s shot, after another Donaldson run, was deflected wide.
Shaleum Logan shot wide following a short corner and a Douglas shot, after he was set up by Trotta, destined for the top corner was blocked by Adam Barrett.
The game was already started to get stretched as Gillingham looked for a leveller and Brentford broke quickly and in large numbers.
The visitors should have levelled when Craig Fagan slipped McDonald through, he got away from the defence but shot wide with only Button to beat.
Legge also had a header blocked but Brentford had the ascendency and looked to double their lead before the break.
Kevin O’Connor headed a Bidwell corner narrowly wide and the Gillingham defence blocked three shots from Judge with increasing desperation as they were unable to clear their line.
The visitors did get in at the break just one behind but the fluency Brentford started to build towards the end of the first period continued in to the second.
Trotta fired straight at Nelson after a fine move involving five or six players and the striker then shot wide at the near post after picking up a George Saville pass.
Another Judge effort was tipped away by Nelson and when the resulting corner was half cleared, Saville set up Trotta but the striker fired wide of the far post.
Gillingham were mainly playing on the counter attack but were occasionally showing signs they could find a goal.
Button saved a low shot from Amine Linganzi and then rushed out to clear at the feet of McDonald.
The visitors brought on an extra striker, Adebayo Akinfenwa, as they chased the game and that made it very open.
Fagan had a shot blocked and then crossed for Legge to volley over.
Donaldson could have sealed it for Brentford when he beat Barrett and Joe Martin to a long Button kick but his low shot was saved by Nelson.
The striker then headed a Bidwell cross over and was tackled by Legge as he looked to be away soon after.
When Brentford got the second goal they had been threatening it came from the penalty spot with 20 minutes remaining.
Craig was tugged down by Barrett as he prepared to meet a Judge corner and referee Keith Stroud pointed to the spot.
Trotta stepped up a rolled the ball to Nelson’s right as the goalkeeper dived the wrong way.
But Gillingham were back in it within three minutes.
A ball through the middle caught Brentford out and McDonald got away, his low shot was half saved by Button but the goalkeeper couldn’t keep it out and it rolled over the line.
McCormack nearly restored Brentford’s two goal lead immediately when a corner was half cleared but his shot was blocked.
And with only one goal in it, Gillingham pressed forward.
They tried to play long to Akinfenwa and use their physicality, and height advantage, to pen Brentford back.
Craig and O’Connor stood up well to the challenge and Douglas mopped up the majority of the loose balls.
But there were still chances for the visitors.
A weak Barrett shot was saved and McDonald fired wide while at the other end Legge sliced a Bidwell ball across the face of his own goal.
Judge fired a Chuba Akpom lay off over as Brentford sought the goal that would probably kill off the game but Gillingham had a great chance to level when Jack Marriott went through with only Button to beat, however the goalkeeper stood up strong and saved the shot.
A Marriott shot then deflected over before Akinfenwa headed the corner wide.
Akpom sliced a shot after a good run and a low Judge shot was saved as the game moved in to injury time with Brentford just one ahead.
Donaldson should have made it safe when he raced on to a Saville pass but his low shot was saved by Nelson with Akpom and McCormack waiting for a cut back.
But Mr Stroud brought the game to a close seconds later and Brentford had extended their run to 14 wins in a 16 match unbeaten Sky Bet League One run.
Brentford: Button; Logan, O’Connor, Craig, Bidwell; McCormack, Douglas, Saville; Donaldson, Trotta (sub Akpom 72 mins), Judge
Subs (not used): Lee, Reeves, Diagouraga, Dallas, Adams, Grigg
Bookings: Saville (41 mins) (seventh of season)
Gillingham: Nelson; Hewitt, Legge, Barrett, Martin; Harriman, Linganzi (sub Akinfenwa 56 mins), Gregory, Weston (sub Dack 56 mins); Fagan (sub Marriott 79 mins), McDonald
Subs (not used): Howard, Davies, Smith, Marriott, Hessenthaler
Bookings: Gregory (32 mins), Harriman (68 mins)
Attendance: 7,713 (829 away fans)
By Chris Wickham