Surrey 560 (Ansari 106, Burns 92, Burke 79, Wilson 72, Durston 6-113) beat Derbyshire 313 (Hughes 96, T Curran 5-71, Ansari 4-61) and 149 (Madsen 76, Durston 57, Batty 6-51) by an innings and 98 runs
Gareth Batty took a hat-trick and 6 for 51 overall as Surrey clinched promotion from LV= County Championship Division Two by beating Derbyshire by an innings and 98 runs at the Kia Oval.
Batty, the 37-year-old Surrey captain, finished the game in style by dismissing Tony Palladino, Mark Footitt and No. 11 Ben Cotton with the second, third and fourth balls of his 17th over.
Palladino was caught at the wicket for 2 and then bowled both Footitt and Cotton, who became the fifth Derbyshire batsman to be out for a duck as they were bowled out for 149 in the second innings.
"That's my first hat-trick in first-class cricket," Batty said. "My only other one came for Yorkshire Under 11s against Lancashire Under 11s at Woodhouse Grange School back in the late 1980s. I think Freddie Flintoff may have been one of my hat-trick victims that day - he was certainly one of my seven wickets! It's difficult to remember, it's a very long time ago."
"Of course it's a nice thing for me, and a great moment, but the hat-trick is really irrelevant because it's winning this match and getting promotion to Division One that matters. To have won this game of cricket and got the points is what's important. It was a must-win game for us, we felt, and I thought we played some magnificent cricket as a team to win it."
Sam and Tom Curran began Derbyshire's slide by each taking a wicket with the new ball as openers Billy Godleman and Ben Slater both fell for ducks.
And Derbyshire, who began their second innings at the start of the final day after Surrey had totalled 560 in reply to their first innings 313, were in some disarray at 9 for 3 when Tom Curran's quick thinking ran out Chesney Hughes for 5 in the eighth over.
Wayne Madsen, the Derbyshire captain, made a battling 76 not out from 154 balls, with 11 fours, and was joined in a fourth wicket stand of 86 in 26 overs by Wes Durston, who also impressed with a determined 57 from 78 balls, but that was Surrey's only lengthy hold-up as they completed a 23-point eighth victory of the season by 2.40pm.
Batty removed both Durston, leg-before, and Harvey Hosein, caught at short leg for a third-ball duck, in the fourth over after lunch and, four overs later, he reduced Derbyshire to 107 for 6 by having Tom Milnes also taken off bat and pad by Rory Burns at short leg for 3.
First to go for Derbyshire was Godleman, who nibbled at a perfectly-pitched outswinger from Sam Curran to edge through to Ben Foakes, keeping in place of Gary Wilson who was nursing a neck muscle strain.
In the next over, still without a run on the board, Slater was leg-before to Tom Curran for an 11-ball duck and, in the eighth over, Hughes's needless run out left Derbyshire rocking.
Madsen straight drove a ball from Sam Curran and his brother Tom intercepted it from mid-on and, seeing Hughes failing to respond immediately to his partner's call, threw to the striker's end for Foakes to complete the run out with the batsman still yards from safety.
An on-driven four by Madsen off Tom Curran, and another boundary punched between mid-on and midwicket later in the over, settled Derbyshire though, and he and Durston went on to build a determined fourth-wicket stand.
At 78 for 3 at lunch, from 30 overs, Derbyshire seemed to have weathered their early storm and looked capable of holding out for a draw despite their 247-run first innings deficit.
Batty's swift intervention after the interval, however, soon settled matters on a fourth-day pitch encouraging the veteran offspinner and the slow left-arm of Zafar Ansari, who broke a stubborn seventh-wicket stand between Madsen and Matt Critchley of 37 in 17 overs by having the latter leg-before for 5.
"James Burke, the two Currans and Zafar Ansari all made significant contributions as young players who, I believe, will be interesting the England selectors," Batty said. "They are also players who can adapt to the needs of the team, which is what we're about.
"Zafar, for instance, is developing into a very fine all-round cricketer and he's the best under-25 spinner in the country in my opinion. He should definitely go to UAE in the Test squad as back-up for Moeen Ali and Adil Rashid. But our success this season has not been about individuals. It's been a squad effort, and that's what you need these days."