In a tense and close race from start to finish, Middlesex suffered their first County Championship defeat of the season; losing to Yorkshire by four wickets on a nerve-tingling third day at Headingley.

Chasing 213, they got there with a straight six from Glenn Maxwell after ten balls of the extra half-hour had been used up.

The win moved the hosts up to second place behind Durham in the table, leaving them level on points with Middlesex who lost their top spot.

Day One

Video Loading

Middlesex hit back after being bowled out for 212 with four quick wickets as Yorkshire ended the day on 96 for four.

Jack Brooks led the way for Yorkshire with a five-wicket haul as the County Champions bowled out table-toppers Middlesex for 212 on the first day of LV=County Championship match at Headingley.

Winning the toss on a dry batting surface tinged with green, Middlesex would have been in even deeper trouble but for a studious knock of 70 from Nick Compton off 153 balls with nine boundaries.

Both sides went into the game unbeaten, Yorkshire being without Adil Rashid and Liam Plunkett who were both on England one-day international duty along with Middlesex's Eoin Morgan and Steven Finn.

Yorkshire had hoped to have veteran left-arm paceman back in the side after a calf injury but he experienced stiffness during the pre-match practice session and was replaced by Will Rhodes.

Batting star: Nick Compton

Brooks, sharing the new ball with Tim Bresnan, was straight into the groove from the start and in his second over he had Joe Burns palpably lbw, but Middlesex were steadied by a patient stand of 62 between Sam Robson and Compton. Robson was the more attacking, particularly through mid-wicket where he picked up his first four boundaries, but Compton was pedestrian by comparison, moving into double figures with his first boundary off his 28th delivery and then taking a further 26 balls to add to his score.

It looked as if the pair would see out the morning session until Robson was bowled by a beauty from Brooks which took middle and off and at lunch Middlesex were still reasonably in control at 83 for two.

But the situation changed rapidly in the afternoon, Dawid Malan receiving a fine ball from Steven Patterson which he edged to wicket-keeper, Jonny Bairstow, who then caught Neil Dexter off Brooks before he had scored.

Compton, looking mainly unperturbed, completed his 50 just after Australian all-rounder, Glenn Maxwell, had been brought on, and the off-spinner claimed three quick wickets to leave Middlesex in disarray on 147 for seven. James Franklin and John Simpson departed in the space of three balls and after Ollie Rayner plundered five boundaries in quick succession off Maxwell he was then bowled through his legs.

Jack Leaning held on to a splendid slip catch at the second attempt to end Compton's defiance and bring Brooks his fourth wicket and after Toby Roland-Jones had gone to Patterson, Brooks rounded things off as Harris hooked him to long leg.

Yorkshire were soon in dire straits themselves, a rapid start by Lyth and Lees fizzling out as both were caught low at second slip by Rayner in consecutive overs from Roland Jones and Tim Murtagh and when Gary Ballance and Andrew Gale fell lbw to Murtagh and Harris respectively the Champions were up against it. Bairstow and Leaning, however, both in prime form, ensured there were no further setbacks before the close.

Day Two

Video Loading

Jonny Bairstow held Yorkshire together with an unbeaten 125 against Middlesex to leave the match in the balance.

On a tricky playing surface, Bairstow continued the phenomenal batting form which had brought him scores of 102, 59, 50 and 66 in his four previous Championship innings since returning to his county side.

With Bairstow on 56 and Yorkshire floundering on 171 for eight in reply to Middlesex's first innings score of 212, both his own century and a first innings lead seemed a long way off.

But Bairstow had managed to advance to 72 when Tim Bresnan departed at 188 to bring in last man, Jack Brooks, who settled into a more sensible mode after twice stealing singles off the last ball of an over.

Bairstow's second of two sixes at the expense of Toby Roland-Jones, who claimed four wickets in the innings, raised the 200 and a boundary off James Harris brought him his century off 161 balls with nine fours and two sixes. It was his tenth in first class matches for Yorkshire, putting him one ahead of his late father David's tally.

Four wickets: Toby Roland-Jones

He drove Ollie Rayner for consecutive sixes, the second being palmed over the line by Roland-Jones, but in the same over Brooks was caught behind, leaving Bairstow stranded after receiving 187 deliveries and spanking ten fours and four sixes.

The tenth wicket stand was worth 59 in 13 overs and it took Yorkshire to 229 and gave them a first innings lead of 17 which was erased by Joe Burns and Sam Robson with little fuss.

They shared an opening stand of 51 together before Brooks struck with consecutive deliveries in the second over after tea, Burns being stunningly caught right handed by Adam Lyth at second slip and Nick Compton getting one which skimmed into his pads.

Almost immediately after Dawid Malan had called for a runner (Burns), Neil Dexter fell lbw to Bresnan, the game then going through a quieter phase as Malan and James Franklin got Middlesex back on an even keel. Their stand was worth 55 by the close and with the visitors 127 for four and leading by 110 it was still anyone's game.

Day Three

Video Loading

The game was nicely balanced when Middlesex resumed on the third morning on 127 for four and leading by 110 and an astute piece of captaincy brought an immediate reward for Yorkshire.

Gale opted for the occasional off-spin of Lyth for the first over and after a couple of close lbw shouts his final ball was edged by Dawid Malan to Tim Bresnan at slip.

Franklin, 33 overnight, continued carefully to shape his best innings for some while but he lost John Simpson at 159 when the wicketkeeper-batsman chopped Bresnan into his stumps.

With Steven Patterson more economical than ever, runs had to be chiselled out and only Rayner could keep Franklin company for any length of time. He went softly in the end, however, gently driving Patterson to Ballance at short cover.

It was the 20-year-old Rhodes who finished off Middlesex in a rush as lunch approached. In the space of 14 balls he had Harris lbw and Roland-Jones brilliantly caught at mid-wicket by Ballance before uprooting Murtagh's off-stump, leaving Franklin stranded on 55 from 126 deliveries with five fours.

In vain: Ollie Rayner's two wickets

Gary Ballance found some of the touch that deserted him in the recent Tests, and with Lyth picking up boundaries whenever the opportunity arose the stand moved on to 71 in 19 overs without too much trouble.

But the balance of power shifted again as Ballance was lured out of his crease by Ollie Rayner's off-spin and in the next over from Toby Roland-Jones, Jonny Bairstow was first dropped by Franklin at first slip and then picked up at second by Rayner.

Andrew Gale soothed nerves by getting off the mark by hitting Rayner for consecutive boundaries but the bowler kept Middlesex in the hunt by having Lyth caught behind for 67 from 131 deliveries with 11 sweetly-timed fours.

Now Jack Leaning showed positive intend by driving Rayner for four and six and stroking Roland-Jones to the cover boundary. He had moved to 25 when James Harris had him caught at second slip with 44 still wanted at 169 for five.

Gale's calm momentarily deserted him as he stepped down the pitch to Tim Murtagh and edged into his stumps for a courageous captain's innings of 37 with six fours.

Maxwell was joined by 20-year-old Will Rhodes and the game finally shifted Yorkshire's way as Maxwell at last found the right mix of attack and defence. With only ten required when the extra half hour was claimed the result was a formality.