Yorkshire climbed up to second in the table after inflicting a first LV= County Championship defeat of the season on previous leaders Middlesex following a hard-fought victory at Headingley.
Chasing 213, the reigning champions sealed a four-wicket win with a straight six from Glenn Maxwell after 10 balls of the extra half-hour on day three had been used up.
The result moves Yorkshire into the top two behind new Division One leaders Durham, leaving them level on points with Middlesex who lost their top spot.
With plenty of time at their disposal, Yorkshire began their victory quest straight after lunch having bowled Middlesex out for 229 in their second innings, and Adam Lyth and Alex Lees carefully took 27 off the first 14 overs before the latter fell lbw to James Franklin.
Happily for Yorkshire, England batsman 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 second-wicket 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.
Captain 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.
Jack Leaning showed positive intent by driving Rayner for four and six and stroking Roland-Jones to the cover boundary but, having moved to 25, he was caught at second slip off James Harris with 44 still needed for victory at 169-5.
Gale’s calm momentarily deserted him as he stepped down the pitch to Tim Murtagh and edged into his stumps having made 37 with six fours.
Maxwell was joined by 20-year-old Will Rhodes and the game finally shifted Yorkshire’s way as the Australian at last found the right mix of attack and defence.
With only 10 required when the extra half hour was claimed the result was a formality, Maxwell striking a four and six off the first four balls of Harris’ over to get Yorkshire over the finishing line.
Yorkshire coach Jason Gillespie admitted it was far from easy but had faith his side would reach their victory target.
He said: “The game was a tough one but I was confident we could win it once we knew what we would be chasing and I would have been happy to chase 300. I would have backed our players to do that.
“It would have been tough but we have the players to get the job done.”
RESULT: Middlesex 212 (NRD Compton 70, JA Brooks 5-44) & 229 (J EC Franklin 55no); Yorkshire 229 (JM Bairstow 125no, TS Roland-Jones 4-78) & 215-6 (A Lyth 67). Yorkshire (20pts) beat Middlesex (4pts) by 4 wkts.