Nottinghamshire 384 (Slater 140, Clarke 70) and 210 for 8 (Slater 49, Robson 4-46) beat Middlesex 366 (Higgins 137, Eskinazi 58, Yadav 56, Hutton 5-94) and 224 for 6 dec (Robson 105*) by two wickets
Middlesex's latest stay in Division One of the LV= Insurance County Championship is over, although they at least went down with a fight on a dramatic final day at Trent Bridge.
In a match they ultimately had to win, following Kent's draw against Lancashire, to avoid joining Northamptonshire in Division Two next season, there had looked to be only one outcome as skipper Toby Roland-Jones set Nottingham a target of just 207 in a generous 58 overs.
But on a dry, turning pitch on a beautifully sunny last afternoon, spinners Jayant Yadav, Josh De Caires and Sam Robson - who finished with a career-best 4 for 46 with his legspin - gave the home side a real scare before Matt Montgomery (34 not out) held the tail together to drag Nottinghamshire across the line at eight down, with 16 balls to spare.
Fittingly, it was No. 10 Jake Ball - in his final appearance for Nottinghamshire - who swept Robson for the winning boundary.
Earlier, as Nottinghamshire set fields that allowed Middlesex to set the game up, Robson hit an 109-ball unbeaten 105 that contained only three fours, and De Caires 49 from 47 as the two shared an 83-run sixth-wicket partnership before the declaration came, with Roland-Jones needing to take a gamble if his bowlers were to have any chance of taking 10 wickets on a pitch that, while taking spin, was still essentially a good surface for batting.
Brett Hutton's 2 for 38 had confirmed him as the season's leading wicket-taker across both divisions on 62 and as Ben Slater added a 49 to his first-innings 140 Nottinghamshire looked to be cruising on 133 for 2.
There had been only sporadic glimmers of hope for Middlesex. Haseeb Hameed, without a hundred this year after four in 2022, pulled Tom Helm straight to square leg in the 16th over. Ten overs later, John Simpson executed a sharp stumping to enable De Caires to end Steven Mullaney's progress at 30 from 34 balls.
But then wickets came in consecutive overs twice as the turning ball suddenly became a potent weapon. Joe Clarke was bowled by offspinner Jayant for 22 in the 31st, before Slater was leg before to Robson in the 32nd.
Tom Moores was caught at deep midwicket on the slog-sweep off Robson in the 36th and Lyndon James leg before on the back foot to Jayant in the 37th, leaving Nottinghamshire 152 for 6, still 55 short of the target.
And the odds looked to be tipping firmly in Middlesex's favour as Robson bowled Calvin Harrison in the 40th, giving Robson career-best figures with the ball as a bonus. But Montgomery played the spinners well and Hutton brought a calm authority to proceedings, the pair adding 45 for the seventh wicket.
There was still for one more scare as Hutton, with just five needed, swiped at Robson to be caught behind.
But Ball kept his nerve to get the job done, punching the air as his sweep off Robson beat the infield, achieving for a fourth win of the season and a sixth-place finish for Nottinghamshire, who were promoted with Middlesex as Division Two champions last year.
At the start of the day, with just one slip in place as Ball bowled the opening delivery with a ball just three overs old, it was clear that Nottinghamshire were happy to let Middlesex progress at their own pace towards the declaration they had in mind. Quite soon there were no slips and ultimately nine Nottinghamshire players stationed by the boundary rope.
The wonder was that Middlesex managed to lose five wickets in taking their total to 177 in the 29 overs up to lunch, although Stevie Eskinazi's freakish demise capped an unfortunate match for the former captain.
His firm drive towards mid-on hit Robson on the foot at the non-striker's end and rolled gently towards Mullaney, the bowler, who picked up the ball and lobbed it to wicketkeeper Tom Moores with Eskinazi, who had copped one on the helmet on day one, hopelessly stranded.
Either side of this moment of comedy - dark comedy from a Middlesex point of view - Mark Stoneman picked out Lyndon James at deep midwicket and Max Holden fell to an excellent catch by Ball at third man as Hutton extended his wickets tally for the season, before Dane Paterson raised his total to 50 - for the third consecutive season - by having Ryan Higgins caught behind off a thin edge and Mullaney removed Simpson via a much thicker edge, a steepler that Moores had to run to backward point to take.
A breezy innings by De Caires either side of lunch helped things along, the young allrounder lofting Ball into the Fox Road stand beyond square leg before he was caught at deep extra flinging the bat.
It gave Ball his final wicket as a Nottinghamshire player - and the first from the Stuart Broad End, as the pavilion end here will henceforth be known following a lunchtime announcement in the presence of the retired England pace bowler.
Moments later, Robson completed his third hundred of the season, Middlesex declared, mindful mostly of how many overs their bowlers might need to have any chance of taking 10 wickets, and Ball led his team-mates off the field for the last time. Another county will surely find room for him next season.