A thrilling Toby Roland-Jones hat-trick provided a suitably dramatic end to a magnificent Specsavers County Championship finale as Middlesex clinched their first title for 23 years by beating champions Yorkshire by 61 runs with 28 balls to spare on a golden, sunlit evening at Lord’s.

An eleventh championship title, their first since 1993, and a first to be won on their home ground at Lord’s since 1920, was Middlesex’s deserved reward for a brave declaration as the county cricket season ended in unforgettable scenes.

Yorkshire, set 240 to win in 40 overs – they also needed a victory to take a third successive title – were bowled out for 178 with Roland-Jones finishing with 6 for 54 and, after bowling Yorkshire last man Ryan Sidebottom around his legs, sprinting away in ecstasy before being engulfed by his joyous teammates.

Roland-Jones had bowled Andy Hodd with the first ball of the 36th over, having removed Azeem Rafiq with the last ball of his previous over. Yorkshire’s players then went on a lap of the ground, as Middlesex began their celebrations, and another fine crowd gave them a generous hand. This was a day when all 22 players were winners, in respect of the entertainment they had served up and the gloss they had put on a much-loved, 126-year-old competition.

Earlier, Yorkshire had served up some declaration bowling once Middlesex’s Dawid Malan and Nick Gubbins had removed the chance of a result by natural means by taking their third wicket stand of 198 in 65 overs.

Malan made 112 and Gubbins 93 to add to his first innings 125, with Middlesex finally declaring on 359 for 6.

At the halfway stage of their chase Yorkshire were 87 for 3, having lost Adam Lyth, Alex Lees and David Willey and needing a further 153 from 20 overs. Lyth, playing defensively on the back foot, edged Toby Roland-Jones to first slip on 13, Lees pulled Tim Murtagh to deep mid wicket to go for 20 and Willey, promoted to No 3, made only 11 before skying Murtagh to deep mid on where Stevie Eskinazi held a fine catch running back.

Bresnan was soon into his stride, however, and helped Gary Ballance to add 50 in ten overs to reinvigorate Yorkshire. Ballance, who slog-swept Ollie Rayner’s off breaks for six, had scored 30 off 39 balls when he swung at Steven Finn and skied to Sam Robson at deep mid on.

Gale, on two, edged Finn for four at catchable height between the keeper and a wide first slip and soon he was thrashing the same bowler through the covers for another boundary as Yorkshire brought the runs required down to two figures.

The Middlesex team celebrate victory (Image: Dan Mullan/Getty Images)

Bresnan, having just thrashed Roland-Jones to the extra cover ropes for the best of his four fours – he clubbed two legside sixes besides, off Rayner and Finn – then tried to whip the next ball away to mid wicket and was adjudged leg-before right across in front of his stumps. It was a brave innings from the makeshift Yorkshire No 5 who had scored 197 runs for just once out in the match.

Gale, on 22, was bowled making room against the impressive Roland-Jones, to leave Yorkshire 160 for 6, and Rafiq soon followed when he skied an attempted big hit to the keeper. It was the 300th first-class wicket of Roland-Jones’s career, but that milestone was lost amid all the excitement.

In between the Roland-Jones hat-trick, Steven Patterson was bowled by Finn for 2 as Yorkshire’s second innings disintegrated in the face of some superb pace bowling.

Middlesex initially fought hard to get to 239 for 3 from 85 overs before Lyth and Lees served up some ‘help-yourself’ spinners while another 120 runs came from 8.5 overs. Sixes and fours came in a flurry, but the gentle offerings – however unedifying – were surely justified in the circumstances. Would anyone have wanted this match, and this wonderful championship finale, simply to have fizzled out in a dull draw? And, what is more, Somerset - who would have been champions if this match ended in a draw - would have resorted to declaration bowling if they had needed to do so to win the title.

The Middlesex team celebrate victory (Image: Dan Mullan/Getty Images)

The declaration arrived when James Franklin skied a return catch to Lyth from the fifth ball of the 94th over of Middlesex’s second innings. Tea was immediately taken, as another fine Lord’s crowd – and thousands more watching on Sky Sports and following the action through websites and social media – gathered themselves for the prospect of a thrilling final session, of the match and the season.

Middlesex started the day on 81 for 2, still 39 runs adrift, with Yorkshire aiming to bowl them out and win the game that way. Gubbins and Malan, however, had other ideas. On 39 and 37 overnight, respectively, the two left-handers batted beautifully to frustrate Yorkshire’s attack on a pitch that looked to have flattened out even more.

Gubbins finally chipped a return catch to off spinner Rafiq just before lunch, but Malan completed his third hundred of the season soon after the interval. He then hit a full toss from Lees straight to square leg in the second over of declaration bowling.

Eskinazi took 22 runs from the 86th over, lobbed up by Lyth, and was 78 not out from 83 balls, with four sixes and ten fours, when the declaration came. John Simpson also hit out for 31 – Yorkshire’s fielders were barely trying to stop the ball going to the boundary – before being bowled by Lees aiming another flamboyant stroke.