Once the cheers of encouragement had died down, there was an electric silence as a large crowd settled.

For both sides, the equation on the last day of the season was straightforward: both had to win to deny Somerset the title.

After half a day of sparring and a spot of collusion, Yorkshire were left to chase 240 in 40 overs to win the trophy for a third successive year.

Despite a courageous effort, with Tim Bresnan adding 55 to his first innings 142 to cap a terrific individual performance, the visitors pulled up agonisingly short, Toby Roland-Jones, the 28-year-old right-arm pace bowler, writing himself into Middlesex folklore by sealing the contest and the Championship with a hat-trick.

No sooner had he bowled Ryan Sidebottom, the No 11 batsman, Roland-Jones peeled away in celebration, finally ending up somewhere around the third-man region beneath a heap of delirious team-mates.

For Yorkshire, there was heartbreak at the ground where they had retained the title 12 months earlier, their quest for the hat-trick frustrated by players who had to stretch every sinew to beat them.

Perhaps the greatest winner, however, was the Championship itself, which can hardly have known such a thrilling denouement.

Going into the last five overs of a six-month season, Middlesex, Somerset and Yorkshire could each have won the crown.

Those who have cut the tournament next year from 16 games per county to 14 would do well to ponder their hideous handiwork.

The first part of yet another impossibly tense day at headquarters was like a prolonged pawn exchange before the main chess pieces were brought into play.

Middlesex, who resumed on 81-2 in their second innings, 39 adrift, had advanced to 239-3 by mid-afternoon, former Leeds university student Nick Gubbins following his first innings hundred with 93, before both sides gave up trying to get a result by natural means.

The pitch was too dead and too flat for that – in stark contrast to the Championship race itself.

So Yorkshire served up pies so juicy that they could almost have been sold in the refreshment bars at Headingley.

Middlesex mowed 120 runs in 8.5 overs before declaring on 359-6, leaving Yorkshire an old John Player League-esque run-chase.

Amid the pre-declaration carnage, Yorkshire opening batsman Alex Lees somehow took the first two wickets of his first-class career: Dawid Malan (116) slapping a full-toss to square-leg, where Jack Brooks seemed uncertain whether to leave it or catch it one-handed, before opting for the latter, and John Simpson (31) missing a straight one.

Middlesex pulled out as soon as captain James Franklin (30) lobbed back a caught-and-bowled to Adam Lyth, leaving Stevie Eskinazi unbeaten on 78.

Although it was an unattractive period of play, with the Yorkshire support staff stationed around the boundary to retrieve the ball quickly, the end most certainly justified the means.

And so after tea came the pivotal final chapters in a day that was previously a slow-burning story.

Lyth and Lees, their bowling work done, did not make the contributions with the bat that they would have hoped for, both falling inside the first 11 overs as Yorkshire slipped to 39-2.

Lyth, defending on the back foot, was caught at first slip off Roland-Jones, while Lees pulled Tim Murtagh to deep mid-wicket.

When David Willey skied Murtagh to wide mid-on, Yorkshire were 48-3 in the 13th over.

Gary Ballance and Bresnan added 50 inside 10 overs, but Ballance took an all-or-nothing swing at Steven Finn and was caught at mid-on.

Although it was not particularly difficult to survive, rapid scoring was not straightforward on the fourth-day pitch, which made the target less generous in reality than it might have seemed in practice. If anyone was going to lead Yorkshire home, it was Bresnan, who carried on from where he left off in the first innings.

Bresnan thumped four fours to go with two sixes before fatally swinging across the line at Roland-Jones, leaving the visitors 153-5.

Gale also swung fatally across the line at Roland-Jones as Yorkshire slid to 160-6, which became 174-7 when Azeem Rafiq skied Roland-Jones to the wicketkeeper, and then 178-8 when Steve Patterson was castled by Finn.

Having taken the wicket of Rafiq with the final delivery of his 12th over, Roland-Jones followed up by bowling wicket-keeper Andrew Hodd and Sidebottom with the first two balls of his 13th over, thus taking a hat-trick to finish with 6-54.

It was an extraordinary end to an extraordinary season, one suitably capped off amid the Middlesex celebrations by the sight of the Yorkshire players and support staff taking to the outfield to salute the supporters who had travelled to London.